Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1101

invalid operator '$SetIntersection' - code 15999

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 1.9.2
    • API
    • Official MongoCSharpDriver 1.9.2

    Description

      I have a collection named ResourceTypeCategory with documents containing a list of value object named Properties. I need the intersection of the persisted array with an input array (see below)

      db.ResourceTypeCategoryRoot.aggregate([ { "$project" : { "intersect" : { "$setIntersection" : ["$Properties.Acronym", ["ROY", "MAJ"]] } } } ]);

      If i run this command on mongod shell it works fine but if i use the mongodb csharp driver method "Aggregate" in "Collection" class of official mongodbcsharpdriver i get this error:

      "Command 'aggregate' failed: exception: invalid operator '$SetIntersection'"

      This is my code:

                  var pipeline = new BsonDocument[]
                  {
                      new BsonDocument
                      {
                          { "$project", new BsonDocument
                                  {
                                      { "intersect", new BsonDocument
                                                              {
                                                                  { "$setIntersection", new BsonArray
                                                                      {   "$Properties.Acronym", 
                                                                          new BsonArray(propertyIds.ToArray())
                                                                      }
                                                                  }
                                                              }
                                          }
                                      }
       
                             }
                      }
                  };
       
                  var test = collection.Aggregate(pipeline);

      Help!

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            mauro.micheli Mauro Micheli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: