db.getMongo() (original) (raw)

Important

mongosh Method

This page documents a mongosh method. This is _not_the documentation for a language-specific driver, such as Node.js.

For MongoDB API drivers, refer to the language-specificMongoDB driver documentation.

db.getMongo()

Returns: The current database connection.

db.getMongo() runs when the shell initiates. Use this command to test that mongosh has a connection to the proper database instance.

This method is available in deployments hosted in the following environments:

Note

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, seeUnsupported Commands.