Tag Info

New answers tagged


Compound indexes are great for static values Flip the WHERE components so that static values are first db.data.find( { c:"test", d:"yes", a: {$gte:1,$lt:2}, b: {$gt: 3} }).sort( { b: 1 } ) Create a different compound index db.data.ensureIndex({c:1},{d:1},{b:1},{a:1}) How does it help ? Static c value Static d value Sorted Range on b One more thing ...

Top 50 recent answers are included