mongos> db.user.find({session: 100000000000068636}) { "_id" : NumberLong("1000000000066536"), "shop" : 144, "session" : [ NumberLong("100000000000068635") ] } { "_id" : NumberLong("1000000000066546"), "shop" : 145, "session" : [ NumberLong("100000000000068645") ] } { "_id" : NumberLong("1000000000066537"), "shop" : 142, "session" : [ NumberLong("100000000000068636") ], "email" : "test@gmail.com" } { "_id" : NumberLong("1000000000066540"), "shop" : 143, "session" : [ NumberLong("100000000000068639") ] } { "_id" : NumberLong("1000000000066541"), "shop" : 143, "session" : [ NumberLong("100000000000068640") ] } { "_id" : NumberLong("1000000000066545"), "shop" : 145, "session" : [ NumberLong("100000000000068644") ] } { "_id" : NumberLong("1000000000066548"), "shop" : 144, "session" : [ NumberLong("100000000000068647") ] } { "_id" : NumberLong("1000000000066534"), "shop" : 144, "session" : [ NumberLong("100000000000068633") ] } { "_id" : NumberLong("1000000000066542"), "shop" : 144, "session" : [ NumberLong("100000000000068641") ] } { "_id" : NumberLong("1000000000066535"), "shop" : 144, "session" : [ NumberLong("100000000000068634") ] } { "_id" : NumberLong("1000000000066538"), "shop" : 144, "session" : [ NumberLong("100000000000068637") ] } { "_id" : NumberLong("1000000000066533"), "shop" : 144, "session" : [ NumberLong("100000000000068632") ] } { "_id" : NumberLong("1000000000066539"), "shop" : 144, "session" : [ NumberLong("100000000000068638") ] } { "_id" : NumberLong("1000000000066544"), "shop" : 144, "session" : [ NumberLong("100000000000068643") ] } { "_id" : NumberLong("1000000000066543"), "shop" : 144, "session" : [ NumberLong("100000000000068642") ] }
versus
mongos> db.user.find({session: NumberLong("100000000000068636") }) { "_id" : NumberLong("1000000000066537"), "shop" : 142, "session" : [ NumberLong("100000000000068636") ], "email" : "test@gmail.com" }
Although i figured out that i was calling it wrong in the first case, i can't possibly imagine what is happening behind the scenes in the first case. How can it possibly work that way? The session field isn't indexed and we run a pretty big cluster.