Adam Harrison
Adam Harrison

Reputation: 3421

Referencing only global locks from db.serverStatus().locks

The server status command prints out locking information in the sub-document named "locks". In this sub-document, global locks are represented with the name "."

( Source: http://docs.mongodb.org/manual/reference/server-status/ )

I can print out this sub-document with the command db.serverStatus().locks and can print out most items with dot notation in the following manner:

> db.serverStatus().locks.local
{
        "timeLockedMicros" : {
                "r" : NumberLong(83054),
                "w" : NumberLong(0)
        },
        "timeAcquiringMicros" : {
                "r" : NumberLong(3005),
                "w" : NumberLong(0)
        }
}

However, I'm unable to select the global lock information ( "." ) due to its...unfortunate naming.

Below, please find my experience:

> db.serverStatus().locks."."
Mon Mar 03 15:55:35.681 SyntaxError: Unexpected string
> db.serverStatus().locks..
...
...
> db.serverStatus().locks...timeLockedMicros
Mon Mar 03 15:56:04.438 SyntaxError: Unexpected token .

Is it possible to individually select this information?

Upvotes: 1

Views: 441

Answers (1)

Anand Jayabalan
Anand Jayabalan

Reputation: 12914

Try this:

>db.serverStatus().locks["."]
{
        "timeLockedMicros" : {
                "R" : NumberLong(428756),
                "W" : NumberLong(877345)
        },
        "timeAcquiringMicros" : {
                "R" : NumberLong(832745),
                "W" : NumberLong(55154)
        }
}

Upvotes: 1

Related Questions