Allow the use of bsonsize in the c# driver

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I am using a multi tenant database and we would like to divide up the costs based on storage.  To find out the amount of data i would like to make use of the bsonsize group operator.

       

      With the 

      C# code

      var match = new BsonDocument
      { {
      "$match", new BsonDocument
      {

      Unknown macro: { "_id.DesignId", new BsonBinaryData(designId, GuidRepresentation.Standard) }

      }
      } };
      var group = new BsonDocument
      { {
      "$group", new BsonDocument

      Unknown macro: { { "_id", BsonNull.Value }

      ,
      { "size", new BsonDocument {

      Unknown macro: { "$bsonSize", "$$ROOT" }

      } },
      }
      } };

      var result = collection.Aggregate(PipelineDefinition<T, BsonDocument>.Create(match, group)).ToEnumerable().ToList();

       

       

      I get the error:
      MongoDB.Driver.MongoCommandException: Command aggregate failed: unknown group operator '$bsonSize'.

       

       

            Assignee:
            Unassigned
            Reporter:
            Hugh Walsh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: