db.getName()
Reference group: Database and collection discovery
What it does
Returns the current database name.
Syntax
db.getName()
Use case
Check that a script targets the intended database.
db.getName(): practical example
db.getName()💡 Explanation
Returns the current database name.
When to use it
Check that a script targets the intended database.
Key Takeaways
- Returns the current database name.
- Typical use: Check that a script targets the intended database.