- Reference >
- Database Commands >
- Replication Commands >
- applyOps
applyOps¶
-
applyOps
¶ Applies specified oplog entries to a
mongod
instance. TheapplyOps
command is primarily an internal command to support sharded clusters.The
applyOps
command has the following prototype form:The
applyOps
command takes a document with the following fields:Field Type Description applyOps
array The oplog entries to apply. preCondition
array Optional. An array of documents that contain the conditions that must be true in order to apply the oplog entry. Each document contains a set of conditions, as described in the next table. The
preCondition
array takes one or more documents with the following fields:Field Type Description ns
string A namespace. If you use this field, applyOps
applies oplog entries only for the collection described by this namespace.q
string Specifies the query that produces the results specified in the res
field.res
string The results of the query in the q
field that must match to apply the oplog entry.
Warning
This command obtains a global write lock and will block other operations until it has completed.