On this page本页内容
Tip
Starting in version 3.2, MongoDB also provides the 从3.2版开始,MongoDB还提供了db.collection.bulkWrite()
method for performing bulk write operations.db.collection.bulkWrite()
方法来执行批量写入操作。
Bulk.find.
hint
()¶New in version 4.2.1.
Sets the 设置hint
option that specifies the index to support the Bulk.find()
for:hint
选项,该选项指定支持Bulkfind()
的索引:
The option can take an index specification document or the index name string.该选项可以采用索引规范文档或索引名称字符串。
If you specify an index that does not exist, the operation errors.如果指定的索引不存在,则操作将出错。
Bulk.find.hint()
has no effect on 对Bulk.find.removeOne()
Bulk.find.removeOne()
没有影响
Create an example collection 创建集合orders
:orders
示例:
Create the following indexes on the example collection:在示例集合上创建以下索引:
The following bulk operations specify different index to use for the various update/replace document operations:以下批量操作指定了用于各种更新/替换文档操作的不同索引:
To view the indexes used, you can use the 要查看使用的索引,可以使用$indexStats
pipeline:$indexStats
管道: