The local Database
Overview
Every mongod
instance has its own local
database, whichstores data used in the replication process, and otherinstance-specific data. The local
database is invisible toreplication: collections in the local
database are not replicated.
Collection on all mongod Instances
local.
startup_log
- On startup, each
mongod
instance inserts a document intostartup_log
with diagnostic information about themongod
instance itself and hostinformation.startup_log
is a cappedcollection. This information is primarily useful for diagnosticpurposes.
For example, the following is a prototype of a document from thestartup_log
collection:
- {
- "_id" : "<string>",
- "hostname" : "<string>",
- "startTime" : ISODate("<date>"),
- "startTimeLocal" : "<string>",
- "cmdLine" : {
- "dbpath" : "<path>",
- "<option>" : <value>
- },
- "pid" : <number>,
- "buildinfo" : {
- "version" : "<string>",
- "gitVersion" : "<string>",
- "sysInfo" : "<string>",
- "loaderFlags" : "<string>",
- "compilerFlags" : "<string>",
- "allocator" : "<string>",
- "versionArray" : [ <num>, <num>, <...> ],
- "javascriptEngine" : "<string>",
- "bits" : <number>,
- "debug" : <boolean>,
- "maxBsonObjectSize" : <number>
- }
- }
Documents in the startup_log
collection contain thefollowing fields:
local.startup_log.
_id
Includes the system hostname and a millisecond epoch value.
The system’s hostname.
A UTC ISODate value that reflects when the server started.
A string that reports the
startTime
in the system’s local time zone.An embedded document that reports the
mongod
runtimeoptions and their values.The process identifier for this process.
- An embedded document that reports information about the buildenvironment and settings used to compile this
mongod
. This is the same output asbuildInfo
. SeebuildInfo
.
Collections on Replica Set Members
local.system.
replset
local.system.replset
holds the replica set’s configurationobject as its single document. To view the object’s configurationinformation, issuers.conf()
from themongo
shell. You can also query this collection directly.
local.oplog.
rs
local.oplog.rs
is the capped collection that holds theoplog. You set its size at creation using theoplogSizeMB
setting. To resize the oplog after replica setinitiation, use the Change the Size of the Oplogprocedure. For additional information, see theOplog Size section.
Note
Starting in MongoDB 4.0, the oplog can grow past its configured sizelimit to avoid deleting the majority commit point
.
local.replset.
minvalid
- This contains an object used internally by replica sets to track replicationstatus.
Restrictions
- Multi-Document Transactions on
local
- You cannot perform read/write operations to the collections in the
local
database inside amulti-document transaction. - Retryable Writes against
local
- You cannot perform write operations to collections in the
local
database with retryable writes enabled.
Important
The official MongoDB 4.2-series drivers enable retryable writes bydefault. Applications which write to the local
databasewill encounter write errors upon upgrading to 4.2-seriesdrivers unless retryable writes are explicitly disabled.
To disable retryable writes, specifyretryWrites=false
in theconnection string for the MongoDB cluster.