Module: Mongo::BulkWrite::Transformable Private

Included in:
OrderedCombiner, UnorderedCombiner
Defined in:
lib/mongo/bulk_write/transformable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defines behavior around transformations.

Since:

  • 2.1.0

Constant Summary collapse

DELETE_MANY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The delete many model constant.

Since:

  • 2.1.0

:delete_many
DELETE_ONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The delete one model constant.

Since:

  • 2.1.0

:delete_one
INSERT_ONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The insert one model constant.

Since:

  • 2.1.0

:insert_one
REPLACE_ONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The replace one model constant.

Since:

  • 2.1.0

:replace_one
UPDATE_MANY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The update many model constant.

Since:

  • 2.1.0

:update_many
UPDATE_ONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The update one model constant.

Since:

  • 2.1.0

:update_one
DELETE_MANY_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform delete many ops.

Since:

  • 2.1.0

lambda { |doc|
  {
    Operation::Q => doc[:filter],
    Operation::LIMIT => 0,
  }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
    d['hint'] = doc[:hint] if doc[:hint]
  end
}
DELETE_ONE_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform delete one ops.

Since:

  • 2.1.0

lambda { |doc|
  {
    Operation::Q => doc[:filter],
    Operation::LIMIT => 1,
  }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
    d['hint'] = doc[:hint] if doc[:hint]
  end
}
INSERT_ONE_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform insert one ops.

Since:

  • 2.1.0

lambda { |doc|
  doc
}
REPLACE_ONE_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform replace one ops.

Since:

  • 2.1.0

lambda { |doc|
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:replacement],
  }.tap do |d|
    d['upsert'] = true if doc[:upsert]
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
    d['hint'] = doc[:hint] if doc[:hint]
    d['sort'] = doc[:sort] if doc[:sort]
  end
}
UPDATE_MANY_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform update many ops.

Since:

  • 2.1.0

lambda { |doc|
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:update],
    Operation::MULTI => true,
  }.tap do |d|
    d['upsert'] = true if doc[:upsert]
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
    d[Operation::ARRAY_FILTERS] = doc[:array_filters] if doc[:array_filters]
    d['hint'] = doc[:hint] if doc[:hint]
  end
}
UPDATE_ONE_TRANSFORM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Proc to transform update one ops.

Since:

  • 2.1.0

lambda { |doc|
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:update],
  }.tap do |d|
    d['upsert'] = true if doc[:upsert]
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
    d[Operation::ARRAY_FILTERS] = doc[:array_filters] if doc[:array_filters]
    d['hint'] = doc[:hint] if doc[:hint]
    d['sort'] = doc[:sort] if doc[:sort]
  end
}
MAPPERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Document mappers from the bulk api input into proper commands.

Since:

  • 2.1.0

{
  DELETE_MANY => DELETE_MANY_TRANSFORM,
  DELETE_ONE => DELETE_ONE_TRANSFORM,
  INSERT_ONE => INSERT_ONE_TRANSFORM,
  REPLACE_ONE => REPLACE_ONE_TRANSFORM,
  UPDATE_MANY => UPDATE_MANY_TRANSFORM,
  UPDATE_ONE => UPDATE_ONE_TRANSFORM
}.freeze