- 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. Usens
to specify a namespace,q
to specify a query andres
to specify the result that the query should match. You may specify zero, one, or manypreCondition
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:applyOps
applies oplog entries from the<operations>
array, to themongod
instance. ThepreCondition
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 thens
option,applyOps
will only apply oplog entries for the collection described by that namespace. You may also specify a query in theq
field with a corresponding expected result in theres
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.