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 behaviour around transformations.

Since:

  • 2.1.0

Constant Summary

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.freeze
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.freeze
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.freeze
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.freeze
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.freeze
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.freeze
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

->(doc){
  { Operation::Q => doc[:filter],
    Operation::LIMIT => 0 }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
  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

->(doc){
  { Operation::Q => doc[:filter],
    Operation::LIMIT => 1 }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
  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

->(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 transfor replace one ops.

Since:

  • 2.1.0

->(doc){
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:replacement],
    Operation::MULTI => false,
    Operation::UPSERT => doc.fetch(:upsert, false)
  }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
  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

->(doc){
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:update],
    Operation::MULTI => true,
    Operation::UPSERT => doc.fetch(:upsert, false)
  }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
  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

->(doc){
  {
    Operation::Q => doc[:filter],
    Operation::U => doc[:update],
    Operation::MULTI => false,
    Operation::UPSERT => doc.fetch(:upsert, false)
  }.tap do |d|
    d[Operation::COLLATION] = doc[:collation] if doc[:collation]
  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