Creates a new MongoClient instance
Name Type Descriptionurl
string
The connection URI string
options
MongoClientOptions optional
Optional settings
Connect to MongoDB using a url as documented at
docs.mongodb.org/manual/reference/connection-string/
Note that for replicasets the replicaSet query parameter is required in the 2.0 driver
Name Type Descriptionurl
string
The connection URI string
options
MongoClientOptions optional
Optional settings
Close the db and its underlying connections
Name Type Default Descriptionforce
boolean false optional
Force close, emitting no events
callback
Db~noResultCallback optional
The result callback
Connect to MongoDB using a url as documented at
docs.mongodb.org/manual/reference/connection-string/
Note that for replicasets the replicaSet query parameter is required in the 2.0 driver
Create a new Db instance sharing the current socket connections. Be aware that the new db instances are
related in a parent-child relationship to the original instance so that events are correctly emitted on child
db instances. Child db instances are cached so performing db('db1') twice will return the same instance.
You can control these behaviors with the options noListener and returnNonCachedInstance.
dbName
string optional
The name of the database we want to use. If not provided, use database name from connection string.
options
object optional
Optional settings.
Name Type Default DescriptionnoListener
boolean false optional
Do not make the db an event listener to the original connection.
returnNonCachedInstance
boolean false optional
Control if you want to return a cached instance or have a new one created
Check if MongoClient is connected
Name Type Descriptionoptions
object optional
Optional settings.
Name Type Default DescriptionnoListener
boolean false optional
Do not make the db an event listener to the original connection.
returnNonCachedInstance
boolean false optional
Control if you want to return a cached instance or have a new one created
Starts a new session on the server
Name Type Descriptionoptions
SessionOptions optional
optional settings for a driver session
Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this cluster. Will ignore all changes to system collections, as well as the local, admin,
and config databases.
pipeline
Array optional
An array of aggregation pipeline stages through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.
options
object optional
Optional settings
Name Type Default DescriptionfullDocument
string 'default' optional
Allowed values: ‘default’, ‘updateLookup’. When set to ‘updateLookup’, the change stream will include both a delta describing the changes to the document, as well as a copy of the entire document that was changed from some time after the change occurred.
resumeAfter
object optional
Specifies the logical starting point for the new change stream. This should be the _id field from a previously returned change stream document.
maxAwaitTimeMS
number optional
The maximum amount of time for the server to wait on new documents to satisfy a change stream query
batchSize
number 1000 optional
The number of documents to return per batch. See aggregation documentation.
collation
object optional
Specify collation settings for operation. See aggregation documentation.
readPreference
ReadPreference optional
The read preference. See read preference documentation.
startAtOperationTime
Timestamp optional
receive change events that occur after the specified timestamp
session
ClientSession optional
optional session to use for this operation
Runs a given operation with an implicitly created session. The lifetime of the session
will be handled without the need for user interaction.
NOTE: presently the operation MUST return a Promise (either explicit or implicity as an async function)
Name Type Descriptionoptions
Object optional
Optional settings to be appled to implicitly created session
operation
function
An operation to execute with an implicitly created session. The signature of this MUST be (session) => {}
The callback format for results
Name Type Descriptionerror
MongoError
An error instance representing the error during the execution.
client
MongoClient
The connected client.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4