New in version 1.4.
An array specifying the desired options.NameTypeDescriptioncommentmixedmaxTimeMSinteger
The cumulative time limit in milliseconds for processing operations on the cursor. MongoDB aborts the operation at the earliest following interrupt point.readConcernreadPreference
Read preference to use for the operation. Defaults to the collection's read preference.session
Client session to associate with the operation.
An estimated number of documents in the collection.
MongoDB\\Exception\\UnexpectedValueException if the command
response from the server was malformed.
MongoDB\\Exception\\UnsupportedException if options are used and
not supported by the selected server (e.g.
MongoDB\\Exception\\InvalidArgumentException for errors related to
the parsing of parameters or options.
MongoDB\\Driver\\Exception\\RuntimeException for other errors at the driver level (e.g. connection errors).
This method returns an estimate of the count of documents in the collection
using collection metadata, rather than counting the documents or consulting an
index. This method does not take a
session option and cannot be executed
within a transaction. See
in the MongoDB manual for more information.
This method is implemented using the count
command. Due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the
command was not included in version "1" of the Stable API. Applications using
this method with the Stable API are recommended to upgrade their server version
to 5.0.9+ or disable strict mode to avoid encountering errors.