MongoDB\Collection Class
Definition
MongoDB\Collection
Provides methods for common operations on collections and documents, including CRUD operations and index management.
You can construct collections directly using the extension's
MongoDB\Driver\Managerclass or select a collection from the library'sMongoDB\Client
orMongoDB\Database
classes. A collection may also be cloned from an existingMongoDB\Collection
object by using thewithOptions()
method.MongoDB\Collection
supports the readConcern, readPreference, typeMap, and writeConcernoptions. If you omit an option, the collection inherits the value from the Managerconstructor argument or theClient
orDatabase
object used to select the collection.Operations within the
MongoDB\Collection
class inherit the collection's options.