开发者

mongodb indexes with $where

开发者 https://www.devze.com 2023-01-06 07:47 出处:网络
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?:

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

精彩评论

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