1对多群发消息,文档结构如下:
{
"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 }
]
}
其中to_uid.user_id=100002,设置为is_del=1。执行以下指令的时候,这个文档还会显示。 貌似查询条件里的"to_uid.user_id" "to_uid.is_del" 是或的关系?
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})
I encountered the same problem, and I always thought it was or , not &&,
I wonder if the author has solved it?