- Reference >
mongo
Shell Methods >- Bulk Operation Methods >
- Bulk.find.hint()
Bulk.find.hint()¶
On this page
Tip
Starting in version 3.2, MongoDB also provides the
db.collection.bulkWrite()
method for performing bulk
write operations.
Description¶
-
Bulk.find.
hint
()¶ New in version 4.2.1.
Sets the
hint
option that specifies the index to support theBulk.find()
for: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 onBulk.find.removeOne()
Example¶
Create an example collection 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: