I came across this incidents while working on some MongoDB. I am not sure it is the expected behavior, so thought of posting it.
I have a collection called zipcodes which has following attributes.
So, I need to get the count for two state , I executed following script.
it returned me 1596 which was incorrect. Then started to go more into details, I started with by interchanging the values and then I got a different results.
Then I remove first row and executed it again.
Oops, I got the same values as before. Then I realize that, whenever we pass values for same attribute only the last one will be taken in. So for the above case I should us $in.
This behavior is same for insert, update, find etc.