A Problem of mongodb Document Array Query

  mongodb, question

The 1-to-many mass message has the following document structure:

{
“from_uid” : 10000,
“to_uid” :
[

{ "user_id" : 100002, "is_read" : 1, "is_del" : 1 },
 { "user_id" : 100003, "is_read" : 0, "is_del" : 0 },
 { "user_id" : 100004, "is_read" : 1, "is_del" : 0 }

]
}

Where to_uid.user_id=100002, set to is_del=1. This document will also be displayed when the following instructions are executed. Looks like “to_uid.user_id” “to_uid.is_del” in the query condition is or?

db.notice.find({“to_uid.user_id”:100002, “to_uid.is_del”:0 , “create_time”:8})

db.notice.find({“to_uid”:{$elemMatch:{“user_id”:100002,”is_del”:0}}”create_time”:8})