$并且在$ or中不起作用或表示$ or部分不起作用

时间:2019-01-22 08:40:52

标签: mongoose

"{"_id":ObjectId("**5c41c0ec9c06dd30e8e98b3c**"),"matchUsers":[{"_id":ObjectId("5c42d4bc87eee24a1b291b6e"),"userId":ObjectId("5c40692d47502b0a7945b114")}],"rightSwiped":[{"count":1,"_id":ObjectId("5c46c4964c9d8216ec1bf0d5"),"swipedTime":ISODate("2019-01-22T07:21:58.000Z"),"userId":ObjectId("5c456b2192c95c6003736815")}],"cupidSwiped":[{"count":2,"_id":ObjectId("5c46caf7ca46ee30f2721431"),"swipedTime":ISODate("2019-01-22T07:49:11.000Z"),"userId":ObjectId("5c456b2192c95c6003736815")}],"leftSwiped":[{"count":1,"_id":ObjectId("5c45c7d2f93046360bc4f6da"),"swipedTime":ISODate("2019-01-21T13:23:30.000Z"),"userId":ObjectId("5c41c2514e354a34f7180e85")},{"count":1,"_id":ObjectId("5c46c4964c9d8216ec1bf0d5"),"swipedTime":ISODate("2019-01-22T07:21:58.000Z"),"userId":ObjectId("5c456b2192c95c6003736815")}],"updateStatus":1,"gender":"female"}" 

这是文档(在上方)
1)查询没有错误
2)我不希望根据条件退还此文件
   我已经准备好离开刷了这个用户
3)我的ID为 5c456b2192c95c6003736815 ,向左滑动用户ID为 5c41c0ec9c06dd30e8e98b3c
4)如果刷卡的用户(id为 5c41c0ec9c06dd30e8e98b3c ),则不在列表(用户列表)中返回此用户,但在列表中返回用户

  

({{“ rightSwiped.userId”:{“ $ ne”:“我的ID”}})

此条件不起作用

希望得到我的问题

{"$and":[{"_id":{"$ne":"5c456b2192c95c6003736815"}},{"updateStatus":1},{"gender":"female"},{"$or":[{"$and":[{"leftSwiped.userId":"5c456b2192c95c6003736815"},{"leftSwiped.swipedTime":{"$gte":1548056871000}}]},{"$and":[{"rightSwiped.userId":"5c456b2192c95c6003736815"},{"rightSwiped.swipedTime":{"$gte":1548056871000}}]},{"rightSwiped.userId":{"$ne":"5c456b2192c95c6003736815"}},{"leftSwiped":{"$elemMatch":{"userId":{"$ne":"5c456b2192c95c6003736815"}}}},{"userIds":{"$nin":["5c456b2192c95c6003736815"]}}]}]}

0 个答案:

没有答案