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

Max BSON Document Size is 4MB when should be 16GB, Generating Read Errors

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.11
    • Affects Version/s: 0.9
    • Component/s: None
    • Labels:
      None

      In MongoDB.Bson.BsonDefaults,
      private static int maxDocumentSize = 4 * 1024 * 1024; // 4MB

      should be:
      private static int maxDocumentSize = 4 * 1024 * 1024 * 4; // 4MB * 4 = 16MB

      Otherwise, during a Read, the ReadSize method throws an error:

      private int ReadSize() {
      int size = buffer.ReadInt32();
      if (size < 0)

      { throw new FileFormatException("Size is negative"); }

      if (size > settings.MaxDocumentSize)

      { throw new FileFormatException("Size is larger than MaxDocumentSize"); }

      return size;
      }

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            alexkaminski Alex Kaminski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: