- Reference >
- Database Commands >
- Administration Commands >
- fsyncUnlock
fsyncUnlock¶
On this page
Definition¶
-
fsyncUnlock
¶ Reduces the lock taken by
fsync
(with the lock option) on amongod
instance by 1.Important
The
fsync
lock
andfsyncUnlock
operations maintain a lock count. Eachfsync
lock
operation increments the lock count, andfsyncUnlock
decrements the lock count.To unlock a
mongod
instance for writes, the lock count must be zero. That is, for a given number offsync
lock
operations, you must issue a corresponding number offsyncUnlock
operations to unlock the instance for writes.fsyncUnlock
is an administrative operation. Typically you will usefsyncUnlock
following a database backup operation.To run the
fsyncUnlock
command, use thedb.adminCommand()
method:The
comment
field is optional and may contain a comment of any data type.The operation returns a document with the following fields:
info
Information on the status of the operation lockCount
(New in version 3.4)The number of locks remaining on the instance after the operation. ok
The status code. Tip
The
mongo
shell provides the helper methoddb.fsyncUnlock()
.
Examples¶
Consider a situation where db.fsyncLock()
has been issued two
times. The following fsyncUnlock
operation reduces the
locks taken by db.fsyncLock()
by 1:
The operation returns the following document:
As the lockCount
is greater than 0, the mongod
instance
is locked against writes. To unlock the instance for writes, run the
unlock operation again:
The operation returns the following document:
The mongod
instance is unlocked for writes.