Products
Platform
Atlas
Build on a developer data platform
Platform Services
Database
Deploy a multi-cloud database
Search
Deliver engaging search experiences
Vector Search
Design intelligent apps with gen AI
Stream Processing
Unify data in motion and data at rest
Self Managed
Enterprise Advanced
Run and manage MongoDB yourself
Community Edition
Develop locally with MongoDB
Tools
Compass
Work with MongoDB data in a GUI
Integrations
Integrations with third-party services
Relational Migrator
Migrate to MongoDB with confidence
View All Products
Explore our full developer suite
arrow-right
Build with MongoDB Atlas
Get started for free in minutes
Sign Up
Test Enterprise Advanced
Develop with MongoDB on-premises
Download
Try Community Edition
Explore the latest version of MongoDB
Download
Resources
Documentation
Atlas Documentation
Get started using Atlas
Server Documentation
Learn to use MongoDB
Start With Guides
Get step-by-step guidance for key tasks
Tools and Connectors
Learn how to connect to MongoDB
MongoDB Drivers
Use drivers and libraries for MongoDB
Resources Hub
Get help building the next big thing with MongoDB
arrow-right
Connect
Developer Center
Explore a wide range of developer resources
Community
Join a global community of developers
Courses and Certification
Learn for free from MongoDB
Events and Webinars
Find an event or webinar near you
Solutions
Use cases
Artificial Intelligence
Edge Computing
Internet of Things
Mobile
Payments
Serverless Development
Industries
Financial Services
Telecommunications
Healthcare
Retail
Public Sector
Manufacturing
Solutions Library
Organized and tailored solutions to kick-start projects
arrow-right
Developer Data Platform
Accelerate innovation at scale
Learn more
arrow-right
Startups and AI Innovators
For world-changing ideas and AI pioneers
Learn more
arrow-right
Customer Case Studies
Hear directly from our users
See Stories
arrow-right
Company
Careers
Start your next adventure
Blog
Read articles and announcements
Newsroom
Read press releases and news stories
Partners
Learn about our partner ecosystem
Leadership
Meet our executive team
Company
Learn more about who we are
Contact Us
Reach out to MongoDB
Let’s chat
arrow-right
Investors
Visit our investor portal
Learn more
arrow-right
Pricing
Eng
Support
Sign In
Try Free
menu-vertical
Products
Platform
Atlas
Build on a developer data platform
Platform Services
Database
Deploy a multi-cloud database
Search
Deliver engaging search experiences
Vector Search
Design intelligent apps with gen AI
Stream Processing
Unify data in motion and data at rest
Self Managed
Enterprise Advanced
Run and manage MongoDB yourself
Community Edition
Develop locally with MongoDB
Tools
Compass
Work with MongoDB data in a GUI
Integrations
Integrations with third-party services
Relational Migrator
Migrate to MongoDB with confidence
View All Products
Explore our full developer suite
arrow-right
Build with MongoDB Atlas
Get started for free in minutes
Sign Up
Test Enterprise Advanced
Develop with MongoDB on-premises
Download
Try Community Edition
Explore the latest version of MongoDB
Download
Resources
Documentation
Atlas Documentation
Get started using Atlas
Server Documentation
Learn to use MongoDB
Start With Guides
Get step-by-step guidance for key tasks
Tools and Connectors
Learn how to connect to MongoDB
MongoDB Drivers
Use drivers and libraries for MongoDB
Resources Hub
Get help building the next big thing with MongoDB
arrow-right
Connect
Developer Center
Explore a wide range of developer resources
Community
Join a global community of developers
Courses and Certification
Learn for free from MongoDB
Events and Webinars
Find an event or webinar near you
Solutions
Use cases
Artificial Intelligence
Edge Computing
Internet of Things
Mobile
Payments
Serverless Development
Industries
Financial Services
Telecommunications
Healthcare
Retail
Public Sector
Manufacturing
Solutions Library
Organized and tailored solutions to kick-start projects
arrow-right
Developer Data Platform
Accelerate innovation at scale
Learn more
arrow-right
Startups and AI Innovators
For world-changing ideas and AI pioneers
Learn more
arrow-right
Customer Case Studies
Hear directly from our users
See Stories
arrow-right
Company
Careers
Start your next adventure
Blog
Read articles and announcements
Newsroom
Read press releases and news stories
Partners
Learn about our partner ecosystem
Leadership
Meet our executive team
Company
Learn more about who we are
Contact Us
Reach out to MongoDB
Let’s chat
arrow-right
Investors
Visit our investor portal
Learn more
arrow-right
Pricing
Eng
Support
Sign In
Try Free
menu-vertical
Docs Home
MongoDB Manual
4.4
Introduction
Installation
The
mongo
Shell
MongoDB CRUD Operations
Aggregation
Indexes
Atlas Search
Atlas Vector Search
Change Streams
Transactions
Data Models
Replication
Sharding
Storage
Administration
Security
Frequently Asked Questions
Reference
Operators
Database Commands
mongo
Shell Methods
Collection Methods
Cursor Methods
Database Methods
db.adminCommand()
db.aggregate()
db.commandHelp()
db.createCollection()
db.createView()
db.currentOp()
db.dropDatabase()
db.eval()
db.fsyncLock()
db.fsyncUnlock()
db.getCollection()
db.getCollectionInfos()
db.getCollectionNames()
db.getLastError()
db.getLastErrorObj()
db.getLogComponents()
db.getMongo()
db.getName()
db.getProfilingLevel()
db.getProfilingStatus()
db.getReplicationInfo()
db.getSiblingDB()
db.hello()
db.help()
db.hostInfo()
db.isMaster()
db.killOp()
db.listCommands()
db.logout()
db.printCollectionStats()
db.printReplicationInfo()
db.printSecondaryReplicationInfo()
db.printShardingStatus()
db.printSlaveReplicationInfo()
db.resetError()
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
Object Constructors and Methods
Connection Methods
Native Methods
Client-Side Field Level Encryption Methods
MongoDB Package Components
Configuration File Options
MongoDB Server Parameters
MongoDB Limits and Thresholds
Explain Results
System Collections
Connection Strings
Collation
MongoDB Wire Protocol
Log Messages
Error Codes
Exit Codes and Statuses
Glossary
Default MongoDB Port
Default MongoDB Read Concerns/Write Concerns
Server Sessions
Release Notes
Technical Support
Docs Menu
Rate This Page
Docs Home
/
MongoDB Manual
/
Reference
/
mongo Shell Methods
/
Database Methods
db.getName()
This version of the documentation is archived and no longer supported. View the
current documentation
to learn how to
upgrade your version of MongoDB
.
db.getName()
Returns:
the current database name.
Back
db.getMongo()
Next
db.getProfilingLevel()