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

Allow the use of bsonsize in the c# driver

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      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'.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            hugh.walsh@romaxtech.com Hugh Walsh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: