invalid operator '$SetIntersection' - code 15999

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.9.2
    • Component/s: API
    • Environment:
      Official MongoCSharpDriver 1.9.2
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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!

        1. Program.cs
          3 kB
          Robert Stam

            Assignee:
            Robert Stam
            Reporter:
            Mauro Micheli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: