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



Follow us on Facebook and Twitter for latest update.