- Reference >
- Database Commands >
- applyOps (internal)
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. Usensto specify a namespace,qto specify a query andresto specify the result that the query should match. You may specify zero, one, or manypreConditiondocuments.
applyOpsprovides a way to apply entries from an oplog created by replica set members and master instances in a master/slave deployment.applyOpsis primarily an internal command to support sharding functionality, and has the following prototype form:applyOpsapplies oplog entries from the<operations>array, to themongodinstance. ThepreConditionarray provides the ability to specify conditions that must be true in order to apply the oplog entry.You can specify as many
preConditionsets as needed. If you specify thensoption,applyOpswill only apply oplog entries for the collection described by that namespace. You may also specify a query in theqfield with a corresponding expected result in theresfield 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.