Friday, August 19, 2016

MongoDB Basics -2


**********************************
 GET DB NAME
**********************************

To get current DB name use :



> db.getName()
test

**********************************
GET PREVIOUS ERROR IN SESSION
**********************************

To get previous error for the MongoDB use below query :



> db.getPrevError()
{ "err" : null, "n" : 0, "nPrev" : -1, "ok" : 1 }



**********************************
CHECK MONGODB hostInfo
**********************************

To get the host info for the MongoDB use below query :



> db.hostInfo()
{
        "system" : {
                "currentTime" : ISODate("2016-08-19T15:12:29.998Z"),
                "hostname" : "OMA-508353L",
                "cpuAddrSize" : 64,
                "memSizeMB" : 16009,
                "numCores" : 8,
                "cpuArch" : "x86_64",
                "numaEnabled" : false
        },
        "os" : {
                "type" : "Windows",
                "name" : "Microsoft Windows 7",
                "version" : "6.1 SP1 (build 7601)"
        },
        "extra" : {
                "pageSize" : NumberLong(4096)
        },
        "ok" : 1
}

No comments:

Post a Comment