[COMPASS-4241] $nor operator not usable with aggregation pipeline Created: 17/Apr/20  Updated: 29/Oct/23  Resolved: 20/Apr/20

Status: Closed
Project: Compass
Component/s: Aggregation pipeline
Affects Version/s: 1.19.3
Fix Version/s: 1.21.0

Type: Bug Priority: Minor - P4
Reporter: Prasad Saya Assignee: Durran Jordan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB version 4.2.3


Sprint: Iteration Blackberry

 Comments   
Comment by Prasad Saya [ 17/Apr/20 ]

The way the $match stage filter is specified in the Compass GUI Aggregation is:
{
    $nor: [ { "price": 20 }, { "fee": 2 } ]
}

This gives an error: Expected "[" or AggregationStage but "{" found.

 

The same aggregation from the mongo shell works fine, with these 3 documents:

[ { "_id" : 1, "item" : "abc", "price" : 10, "fee" : 2 }, { "_id" : 2, "item" : "jkl", "price" : 20, "fee" : 1 }, { "_id" : 3, "item" : "xyz", "price" : 5, "fee" : 0 } ]

 

db.collection.aggregate( [
  {
      $match: {
          $nor: [ { price: 20 }, { fee: 2 } ]
            }

    }
] )

 

References:  

 

Generated at Wed Feb 07 22:35:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.