w3resource

MongoDB: db.serverStatus() method

db.serverStatus

The db.serverStatus() method is used to return a document that provides an overview of the state of the database process.

Syntax:

db.serverStatus()

Example: MongoDB: db.serverStatus() method

db.serverStatus( { repl: 0, locks: 0 } );

Output:

> db.serverStatus( { repl: 0, locks: 0 } );
{
        "host" : "bidhan-PC",
        "version" : "2.6.5",
        "process" : "mongod",
        "pid" : NumberLong(6040),
        "uptime" : 1782,
        "uptimeMillis" : NumberLong(1782007),
        "uptimeEstimate" : 1666,
        "localTime" : ISODate("2016-01-14T09:45:30.766Z"),
        "asserts" : {
                "regular" : 0,
                "warning" : 0,
                "msg" : 0,
                "user" : 0,
                "rollovers" : 0
        },
        "backgroundFlushing" : {
                "flushes" : 28,
                "total_ms" : 9182,
                "average_ms" : 327.92857142857144,
                "last_ms" : 8590,
                "last_finished" : ISODate("2016-01-14T09:44:58.155Z")
        },
        "connections" : {
                "current" : 1,
                "available" : 999999,
                "totalCreated" : NumberLong(1)
        },
        "cursors" : {
                "note" : "deprecated, use server status metrics",
                "clientCursors_size" : 0,
                "totalOpen" : 0,
                "pinned" : 0,
                "totalNoTimeout" : 0,
                "timedOut" : 0
        },
        "extra_info" : {
                "note" : "fields vary by platform",
                "page_faults" : 36665,
                "usagePageFileMB" : 34,
                "totalPageFileMB" : 6973,
                "availPageFileMB" : 3701,
                "ramMB" : 3487
        },
        "globalLock" : {
                "totalTime" : NumberLong(1782026000),
                "lockTime" : NumberLong(16499),
                "currentQueue" : {
                        "total" : 0,
                        "readers" : 0,
                        "writers" : 0
                },
                "activeClients" : {
                        "total" : 0,
                        "readers" : 0,
                        "writers" : 0
                }
        },
        "indexCounters" : {
                "accesses" : 3,
                "hits" : 3,
                "misses" : 0,
                "resets" : 0,
                "missRatio" : 0
        },
        "network" : {
                "bytesIn" : 1258,
                "bytesOut" : 3753,
                "numRequests" : 17
        },
        "opcounters" : {
                "insert" : 1,
                "query" : 169,
                "update" : 0,
                "delete" : 0,
                "getmore" : 0,
                "command" : 17
        },
        "opcountersRepl" : {
                "insert" : 0,
                "query" : 0,
                "update" : 0,
                "delete" : 0,
                "getmore" : 0,
                "command" : 0
        },
        "recordStats" : {
                "accessesNotInMemory" : 1,
                "pageFaultExceptionsThrown" : 0,
                "admin" : {
                        "accessesNotInMemory" : 1,
                        "pageFaultExceptionsThrown" : 0
                },
                "local" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                },
                "myinfo" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                },
                "newtest" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                },
                "payroll" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                },
                "test" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                }
        },
        "writeBacksQueued" : false,
        "mem" : {
                "bits" : 32,
                "resident" : 2,
                "virtual" : 573,
                "supported" : true,
                "mapped" : 480
        },
        "metrics" : {
                "cursor" : {
                        "timedOut" : NumberLong(0),
                        "open" : {
                                "noTimeout" : NumberLong(0),
                                "pinned" : NumberLong(0),
                                "total" : NumberLong(0)
                        }
                },
                "document" : {
                        "deleted" : NumberLong(0),
                        "inserted" : NumberLong(1),
                        "returned" : NumberLong(1),
                        "updated" : NumberLong(0)
                },
                "getLastError" : {
                        "wtime" : {
                                "num" : 0,
                                "totalMillis" : 0
                        },
                        "wtimeouts" : NumberLong(0)
                },
                "operation" : {
                        "fastmod" : NumberLong(0),
                        "idhack" : NumberLong(0),
                        "scanAndOrder" : NumberLong(0)
                },
                "queryExecutor" : {
                        "scanned" : NumberLong(0),
                        "scannedObjects" : NumberLong(0)
                },
                "record" : {
                        "moves" : NumberLong(0)
                },
                "repl" : {
                        "apply" : {
                                "batches" : {
                                        "num" : 0,
                                        "totalMillis" : 0
                                },
                                "ops" : NumberLong(0)
                        },
                        "buffer" : {
                                "count" : NumberLong(0),
                                "maxSizeBytes" : 268435456,
                                "sizeBytes" : NumberLong(0)
                        },
                        "network" : {
                                "bytes" : NumberLong(0),
                                "getmores" : {
                                        "num" : 0,
                                        "totalMillis" : 0
                                },
                                "ops" : NumberLong(0),
                                "readersCreated" : NumberLong(0)
                        },
                        "preload" : {
                                "docs" : {
                                        "num" : 0,
                                        "totalMillis" : 0
                                },
                                "indexes" : {
                                        "num" : 0,
                                        "totalMillis" : 0
                                }
                        }
                },
                "storage" : {
                        "freelist" : {
                                "search" : {
                                        "bucketExhausted" : NumberLong(0),
                                        "requests" : NumberLong(0),
                                        "scanned" : NumberLong(0)
                                }
                        }
                },
                "ttl" : {
                        "deletedDocuments" : NumberLong(0),
                        "passes" : NumberLong(28)
                }
        },
        "ok" : 1
}

Retrieve the restaurants data from here

Previous: db.serverCmdLineOpts() method
Next: db.setProfilingLevel() method



Follow us on Facebook and Twitter for latest update.