发布于 2015-09-14 15:07:03 | 167 次阅读 | 评论: 0 | 来源: 网络整理

$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 } } )
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务