Answers for "$match in mongodb"

0

$match in mongodb

$and with $match works just fine.

You have syntax errors in your query. Try this.

db.test.aggregate([
                   { 
                     $match: {
                          $and: [ 
                              {type: {$in: ["TOYS"]}}, 
                              {type: {$nin: ["BARBIE"]}}, 
                              {time: {$lt:ISODate("2013-12-09T00:00:00Z")}}
                          ]
                     }
                   }
                  ])
And for what you are trying to do, you do not need an $and.
Posted by: Guest on March-17-2021

Browse Popular Code Answers by Language