$hint

$hint

The $hint operator forces the query optimizer to use a specific index to fulfill the query. Use $hint for testing query performance and indexing strategies. Consider the following form:

db.collection.find().hint( { age: 1 } )

This operation returns all documents in the collection named collection using the index on the age field. Use this operator to override MongoDB’s default index selection process and pick indexes manually.

You can also specify the option in either of the following forms:

db.collection.find()._addSpecial( "$hint", { age : 1 } )
db.collection.find( { $query: {}, $hint: { age : 1 } } )

MongoDB Manual (Index)

关于

生态系统

格式

资源