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:

  1. {
  2. "_id" : "<string>",
  3. "hostname" : "<string>",
  4. "startTime" : ISODate("<date>"),
  5. "startTimeLocal" : "<string>",
  6. "cmdLine" : {
  7. "dbpath" : "<path>",
  8. "<option>" : <value>
  9. },
  10. "pid" : <number>,
  11. "buildinfo" : {
  12. "version" : "<string>",
  13. "gitVersion" : "<string>",
  14. "sysInfo" : "<string>",
  15. "loaderFlags" : "<string>",
  16. "compilerFlags" : "<string>",
  17. "allocator" : "<string>",
  18. "versionArray" : [ <num>, <num>, <...> ],
  19. "javascriptEngine" : "<string>",
  20. "bits" : <number>,
  21. "debug" : <boolean>,
  22. "maxBsonObjectSize" : <number>
  23. }
  24. }

Documents in the startup_log collection contain thefollowing fields:

  • local.startup_log._id
  • Includes the system hostname and a millisecond epoch value.

  • local.startup_log.hostname

  • The system’s hostname.

  • local.startup_log.startTime

  • A UTC ISODate value that reflects when the server started.

  • local.startup_log.startTimeLocal

  • A string that reports the startTimein the system’s local time zone.

  • local.startup_log.cmdLine

  • An embedded document that reports the mongod runtimeoptions and their values.

  • local.startup_log.pid

  • The process identifier for this process.

  • local.startup_log.buildinfo

  • An embedded document that reports information about the buildenvironment and settings used to compile thismongod. This is the same output asbuildInfo. See buildInfo.

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, issue rs.conf() from the mongoshell. You can also query this collection directly.

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 thelocal database inside amulti-document transaction.
  • Retryable Writes against local
  • You cannot perform write operations to collections in the localdatabase 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.