Man, MongoDB's handling of array fields in queries is really confusing me. I always thought that when the target field was an array that the document would match if any of the array elements matched. But apparently that's not always true:
> db.test.find()
{ "_id" : ObjectId("4fe0ebac8ee0adc8c442fa02"), "colors" : [ "blue", "black" ] }
{ "_id" : ObjectId("4fe0ebbd8ee0adc8c442fa03"), "colors" : [ "yellow", "orange", "red" ] }
>
> db.test.find({colors:{$ne:"red"}})
{ "_id" : ObjectId("4fe0ebac8ee0adc8c442fa02"), "colors" : [ "blue", "black" ] }
>
Looks like $ne at least is handled specially. I thought this would match both documents, since both of them have some value that is $ne to "red".