将此函数用于诸如“count”或“distinct”之类的命令。
读取偏好、读关注(read concern)和排序规则可以被各种来源覆盖。 在ACID 事务中, opts中禁止读关注(read concern)和写关注(write concern),并且读取偏好(read preference)必须是主节点 (primary node in the replica set)或 NULL。 下表首先列出了这些选项的最高优先级源。 未应用任何写关注(write concern)。
读取偏好 | 读关注 (read concern) | 排序规则 |
|---|---|---|
|
|
|
事务 | 事务 | |
|
================== ============== ========= 读取偏好 读关注排序规则 ==== ============== ============== ========= read_prefs opts opts事务 事务database, client , collection ================== ============== =========
请参阅事务 和带选项的 “distinct”命令的示例。