new MongoClient(){MongoClient}
Creates a new MongoClient instance
Returns:
MongoClient instance.Methods
-
staticMongoClient.connect(url, options, callback){null}
-
Connect to MongoDB using a url as documented at
docs.mongodb.org/manual/reference/connection-string/
Name Type Default Description url
string The connection URI string
options
object null optional Optional settings.
Name Type Default Description uri_decode_auth
boolean false optional Uri decode the user name and password for authentication
db
object null optional A hash off options to set on the db object, see Db constructor
server
object null optional A hash off options to set on the server objects, see Server constructor**
replSet
object null optional A hash off options to set on the replSet object, see ReplSet constructor**
mongos
object null optional A hash off options to set on the mongos object, see Mongos constructor**
callback
MongoClient~connectCallback The command result callback
-
connect(url, options, callback){null}
-
Connect to MongoDB using a url as documented at
docs.mongodb.org/manual/reference/connection-string/
Name Type Default Description url
string The connection URI string
options
object null optional Optional settings.
Name Type Default Description uri_decode_auth
boolean false optional Uri decode the user name and password for authentication
db
object null optional A hash off options to set on the db object, see Db constructor
server
object null optional A hash off options to set on the server objects, see Server constructor**
replSet
object null optional A hash off options to set on the replSet object, see ReplSet constructor**
mongos
object null optional A hash off options to set on the mongos object, see Mongos constructor**
callback
MongoClient~connectCallback The command result callback
Type Definitions
-
connectCallback(error, db)
-
The callback format for results
Name Type Description error
MongoError An error instance representing the error during the execution.
db
Db The connected database.