Module: Mongo::BulkWrite::Transformable Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/mongo/bulk_write/transformable.rb |
Overview
Defines behavior around transformations.
Constant Summary
-
DELETE_MANY =
The delete many model constant.
:delete_many.freeze
-
DELETE_MANY_TRANSFORM =
Proc to transform delete many ops.
->(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 =
The delete one model constant.
:delete_one.freeze
-
DELETE_ONE_TRANSFORM =
Proc to transform delete one ops.
->(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 =
The insert one model constant.
:insert_one.freeze
-
INSERT_ONE_TRANSFORM =
Proc to transform insert one ops.
->(doc){ doc }
-
MAPPERS =
Document mappers from the bulk api input into proper commands.
{ 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
-
REPLACE_ONE =
The replace one model constant.
:replace_one.freeze
-
REPLACE_ONE_TRANSFORM =
Proc to transfor replace one ops.
->(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] end }
-
UPDATE_MANY =
The update many model constant.
:update_many.freeze
-
UPDATE_MANY_TRANSFORM =
Proc to transform update many ops.
->(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 =
The update one model constant.
:update_one.freeze
-
UPDATE_ONE_TRANSFORM =
Proc to transform update one ops.
->(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] end }
Instance Method Summary
- #transform(name, document) private Internal use only
Instance Method Details
#transform(name, document) (private)
# File 'lib/mongo/bulk_write/transformable.rb', line 150
def transform(name, document) validate(name, document) MAPPERS[name].call(document) end