Navigation
This version of the documentation is archived and no longer supported.

The local Database

Overview

Every mongod instance has its own local database, which stores data used in the replication process, and other instance-specific data. The local database is invisible to replication: collections in the local database are not replicated.

In replication, the local database store stores internal replication data for each member of a replica set. The local stores the following collections:

Changed in version 2.4: When running with authentication (i.e. authorization), authenticating to the local database is not equivalent to authenticating to the admin database. In previous versions, authenticating to the local database provided access to all databases.

Collection on all mongod Instances

local.startup_log

On startup, each mongod instance inserts a document into startup_log with diagnostic information about the mongod instance itself and host information. startup_log is a capped collection. This information is primarily useful for diagnostic purposes.

Example

Consider the following prototype of a document from the startup_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 the following 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 startTime in the system’s local time zone.

local.startup_log.cmdLine

An embedded document that reports the mongod runtime options 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 build environment and settings used to compile this mongod. This is the same output as buildInfo. See buildInfo.

Collections on Replica Set Members

local.system.replset

local.system.replset holds the replica set’s configuration object as its single document. To view the object’s configuration information, issue rs.conf() from the mongo shell. You can also query this collection directly.

local.oplog.rs

local.oplog.rs is the capped collection that holds the oplog. You set its size at creation using the oplogSizeMB setting. To resize the oplog after replica set initiation, use the Change the Size of the Oplog procedure. For additional information, see the Oplog Size section.

local.replset.minvalid

This contains an object used internally by replica sets to track replication status.

local.slaves

Removed in version 3.0: Replica set members no longer mirror replication status of the set to the local.slaves collection. Use rs.status() instead.

Collections used in Master/Slave Replication

In master/slave replication, the local database contains the following collections:

  • On the master:

    local.oplog.$main

    This is the oplog for the master-slave configuration.

    local.slaves

    Removed in version 3.0: MongoDB no longer stores information about each slave in the local.slaves collection. Use db.serverStatus( { repl: 1 } ) instead.

  • On each slave:

    local.sources

    This contains information about the slave’s master server.