Docs Menu
MongoDB Documentation
MongoDB Manual
Select a version
Introduction
MongoDB Shell (mongosh)
MongoDB CRUD Operations
Aggregation Operations
Data Models
Transactions
Indexes
Security
Change Streams
Replication
Sharding
Administration
Storage
Frequently Asked Questions
Reference
Operators
Database Commands
mongosh
Methods
Collection Methods
Cursor Methods
Database Methods
db.adminCommand()
db.aggregate()
db.cloneDatabase()
db.commandHelp()
db.copyDatabase()
db.createCollection()
db.createView()
db.currentOp()
db.dropDatabase()
db.fsyncLock()
db.fsyncUnlock()
db.getCollection()
db.getCollectionInfos()
db.getCollectionNames()
db.getLogComponents()
db.getMongo()
db.getName()
db.getProfilingStatus()
db.getReplicationInfo()
db.getSiblingDB()
db.hello()
db.help()
db.hostInfo()
db.killOp()
db.listCommands()
db.logout()
db.printCollectionStats()
db.printReplicationInfo()
db.printSecondaryReplicationInfo()
db.printShardingStatus()
db.printSlaveReplicationInfo()
db.resetError()
db.rotateCertificates()
db.runCommand()
db.serverBuildInfo()
db.serverCmdLineOpts()
db.serverStatus()
db.setLogLevel()
db.setProfilingLevel()
db.shutdownServer()
db.stats()
db.version()
db.watch()
Query Plan Cache Methods
Bulk Operation Methods
User Management Methods
Role Management Methods
Replication Methods
Sharding Methods
Free Monitoring Methods
Object Constructors and Methods
Connection Methods
Native Methods in
mongosh
Client-Side Field Level Encryption Methods
Legacy
mongo
Shell
MongoDB Package Components
Configuration File Options
MongoDB Server Parameters
MongoDB Limits and Thresholds
Explain Results
System Collections
Connection String URI Format
Collation
MongoDB Wire Protocol
Log Messages
Exit Codes and Statuses
Glossary
Default MongoDB Port
Default MongoDB Read Concerns/Write Concerns
Server Sessions
Stable API
Release Notes
Technical Support
Docs Home
→
MongoDB Manual
db.version()
This version of the documentation is archived and no longer supported. View the
current documentation
to learn how to
upgrade your version of MongoDB server
.
db.version()
Returns:
The version of the
mongod
or
mongos
instance.
←
db.stats()
db.watch()
→
Share Feedback