w3resource

MongoDB: db.getMongo() method

db.getMongo

The db.getMongo() method is used to return the Mongo() connection object for the current connection.

Syntax:

db.getMongo()

Returns: The current database connection.

Example: MongoDB: db.getMongo() method

The following statement returns the connection object for the current connection.

db.getMongo();

Output:

> db.getMongo();
connection to 127.0.0.1

Retrieve the restaurants data from here

Previous: db.getLastErrorObj() method
Next: db.getName() method



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/mongodb/shell-methods/database/db-getMongo.php