Reduces the lock taken by db.fsyncLock() on a mongod instance by 1.


The db.fsyncLock() and db.fsyncUnlock() operations maintain a lock count. db.fsyncLock() increments the lock count, and db.fsyncUnlock() decrements the lock count.

To unlock a mongod instance for writes, the lock count must be zero. That is, for a given number of db.fsyncLock() operations, you must issue a corresponding number of db.fsyncUnlock() operations to unlock the instance for writes.

db.fsyncUnlock() is an administrative operation. Typically you will use db.fsyncUnlock() following a database backup operation.

db.fsyncUnlock() has the syntax:


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.

The db.fsyncUnlock() method wraps the fsyncUnlock command.

Compatibility with WiredTiger

Changed in version 3.2: db.fsyncLock() can ensure that the data files do not change for MongoDB instances using either the MMAPv1 or the WiredTiger storage engines, thus providing consistency for the purposes of creating backups.

In previous MongoDB versions, db.fsyncLock() cannot guarantee a consistent set of files for low-level backups (e.g. via file copy cp, scp, tar) for WiredTiger.


Consider a situation where db.fsyncLock() has been issued two times. The following db.fsyncUnlock() operation reduces the locks taken by db.fsyncLock() by 1:


The operation returns the following document:

{ "info" : "fsyncUnlock completed", "lockCount" : NumberLong(1), "ok" : 1 }

As the lockCount is greater than 0, the mongod instance is locked against writes. To unlock the instance for writes, run db.fsyncLock() again:


The operation returns the following document:

{ "info" : "fsyncUnlock completed", "lockCount" : NumberLong(0), "ok" : 1 }

The mongod instance is unlocked for writes.