MongoDB\Collection类
定义
MongoDB\Collection
提供了在集合和文档上执行常见操作的方法,包括CRUD操作和索引管理。
您可以使用扩展的MongoDB\Driver\Manager类直接构建集合,或者从库的
MongoDB\Client
或MongoDB\Database
类中选择一个集合。集合还可以通过withOptions()
方法从一个现有的MongoDB\Collection
对象进行克隆。MongoDB\Collection
supports the readConcern, readPreference, typeMap, and writeConcern options. If you omit an option, the collection inherits the value from the Manager constructor argument or theClient
orDatabase
object used to select the collection.在
MongoDB\Collection
类中执行的操作继承了集合的选项。