lib/mongo/bulk_write/transformable.rb in mongo-2.1.0.rc0 vs lib/mongo/bulk_write/transformable.rb in mongo-2.1.0

- old
+ new

@@ -54,18 +54,18 @@ # Proc to transform delete many ops. # # @since 2.1.0 DELETE_MANY_TRANSFORM = ->(doc){ - { q: doc[:filter], limit: 0 } + { Operation::Q => doc[:filter], Operation::LIMIT => 0 } } # Proc to transform delete one ops. # # @since 2.1.0 DELETE_ONE_TRANSFORM = ->(doc){ - { q: doc[:filter], limit: 1 } + { Operation::Q => doc[:filter], Operation::LIMIT => 1 } } # Proc to transform insert one ops. # # @since 2.1.0 @@ -75,24 +75,39 @@ # Proc to transfor replace one ops. # # @since 2.1.0 REPLACE_ONE_TRANSFORM = ->(doc){ - { q: doc[:filter], u: doc[:replacement], multi: false, upsert: doc.fetch(:upsert, false) } + { + Operation::Q => doc[:filter], + Operation::U => doc[:replacement], + Operation::MULTI => false, + Operation::UPSERT => doc.fetch(:upsert, false) + } } # Proc to transform update many ops. # # @since 2.1.0 UPDATE_MANY_TRANSFORM = ->(doc){ - { q: doc[:filter], u: doc[:update], multi: true, upsert: doc.fetch(:upsert, false) } + { + Operation::Q => doc[:filter], + Operation::U => doc[:update], + Operation::MULTI => true, + Operation::UPSERT => doc.fetch(:upsert, false) + } } # Proc to transform update one ops. # # @since 2.1.0 UPDATE_ONE_TRANSFORM = ->(doc){ - { q: doc[:filter], u: doc[:update], multi: false, upsert: doc.fetch(:upsert, false) } + { + Operation::Q => doc[:filter], + Operation::U => doc[:update], + Operation::MULTI => false, + Operation::UPSERT => doc.fetch(:upsert, false) + } } # Document mappers from the bulk api input into proper commands. # # @since 2.1.0