开发者

mongodb indexes with $where

If I write a query and filter results using $where on an indexed field, will it use the index or will it scan into each document? For开发者_Python百科 example?:

function () { return this.indexed_field > 5 }

..and yes I'm well aware I could get away with using $gt in this particular instance =)


No, an index won't be used in that case. You can run an explain() to verify.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜