How can I to know if my database MongoDB is 64 bits?

You can use buildInfo along with runCommand to check whether your MongoDB database is running on 32-bit or 64-bit architecture. The key field to look for in the output is "bits".

Syntax

use admin
db.runCommand("buildInfo")

Example

First, switch to the admin database and then run the buildInfo command ?

use admin
db.runCommand("buildInfo");
switched to db admin

The output will display detailed build information about your MongoDB instance ?

{
    "version" : "4.0.5",
    "gitVersion" : "3739429dd92b92d1b0ab120911a23d50bf03c412",
    "targetMinOS" : "Windows 7/Windows Server 2008 R2",
    "modules" : [ ],
    "allocator" : "tcmalloc",
    "javascriptEngine" : "mozjs",
    "sysInfo" : "deprecated",
    "versionArray" : [
        4,
        0,
        5,
        0
    ],
    "openssl" : {
        "running" : "Windows SChannel"
    },
    "buildEnvironment" : {
        "distmod" : "2008plus-ssl",
        "distarch" : "x86_64",
        "cc" : "cl: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24223 for x64",
        "target_arch" : "x86_64",
        "target_os" : "windows"
    },
    "bits" : 64,
    "debug" : false,
    "maxBsonObjectSize" : 16777216,
    "storageEngines" : [
        "devnull",
        "ephemeralForTest",
        "mmapv1",
        "wiredTiger"
    ],
    "ok" : 1
}

Key Points

  • The "bits" : 64 field confirms this is a 64-bit MongoDB installation
  • For 32-bit systems, you would see "bits" : 32
  • The "distarch" : "x86_64" and "target_arch" : "x86_64" also indicate 64-bit architecture

Conclusion

Use db.runCommand("buildInfo") from the admin database to check your MongoDB architecture. The "bits" field directly shows whether your MongoDB instance is 32-bit or 64-bit.

Updated on: 2026-03-15T00:28:34+05:30

186 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements