Navigation
This version of the documentation is archived and no longer supported.

applyOps (internal)

applyOps
Parameters:
  • operations (array) – an array of operations to perform.
  • preCondition (array) – Optional. Defines one or more conditions that the destination must meet applying the entries from the <operations> array. Use ns to specify a namespace, q to specify a query and res to specify the result that the query should match. You may specify zero, one, or many preCondition documents.

applyOps provides a way to apply entries from an oplog created by replica set members and master instances in a master/slave deployment. applyOps is primarily an internal command to support sharding functionality, and has the following prototype form:

db.runCommand( { applyOps: [ <operations> ], preCondition: [ { ns: <namespace>, q: <query>, res: <result> } ] } )

applyOps applies oplog entries from the <operations> array, to the mongod instance. The preCondition array provides the ability to specify conditions that must be true in order to apply the oplog entry.

You can specify as many preCondition sets as needed. If you specify the ns option, applyOps will only apply oplog entries for the collection described by that namespace. You may also specify a query in the q field with a corresponding expected result in the res field that must match in order to apply the oplog entry.

Warning

This command obtains a global write lock and will block other operations until it has completed.

←   aggregate authenticate  →