using $and with $match in mongodb

后端 未结 3 1222
孤街浪徒
孤街浪徒 2020-12-13 04:31

I am trying to use the following query in MongoDB but it is not working.

db.test.aggregate(
$match: {$and: [type: {$in: [\"TOYS\"]}, type: {$nin: [\"BARBIE\"         


        
3条回答
  •  死守一世寂寞
    2020-12-13 04:58

    {
      $match: {
        $or:[
          {'sender':sender, 'recipient':recipient},
          {'recipient':sender,'sender':recipient}
        ]
      }
    }
    

    using $or

提交回复
热议问题