tags:

views:

17

answers:

1

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 example?:

function () { return this.indexed_field > 5 }

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

A: 

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

Kyle Banker