Docs Menu

Docs HomeMongoDB Manual

Connection Methods


For details on a specific method, including syntax and examples, click on the link to the method's reference page.

Connects to a MongoDB instance and to a specified database on that instance.
Creates a new connection object.
Returns a database object.
Returns a list of databases.
Returns a document with a list of databases and metadata.
Returns the current read preference mode for the MongoDB connection.
Returns the read preference tag set for the MongoDB connection.
Returns the write concern for the connection object.
Enables or disables causal consistency on the connection object.
Sets the read preference for the MongoDB connection.
Sets the write concern for the connection object.
Starts a session on the connection object.
Opens a change stream cursor for a deployment to report on all its non-system collections across all its databases, excluding the internal admin, local, and config databases.
The session object.
The options object for the session.
←  WriteResult.hasWriteConcernError()connect() →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.