- Reference >
mongoShell Methods >- Database Methods >
- db.fsyncLock()
db.fsyncLock()¶
-
db.fsyncLock()¶ Forces the
mongodto flush all pending write operations to the disk and locks the entiremongodinstance to prevent additional writes until the user releases the lock with thedb.fsyncUnlock()command.db.fsyncLock()is an administrative command.This command provides a simple wrapper around a
fsyncdatabase command with the following syntax:This function locks the database and create a window for backup operations.
Important
db.fsyncLock()may block reads, including those necessary to verify authentication. Such reads are necessary to establish new connections to amongodthat enforces authorization checks.Warning
When calling
db.fsyncLock(), ensure that the connection is kept open to allow a subsequent call todb.fsyncUnlock().Closing the connection may make it difficult to release the lock.