[CSHARP-866] LazyBsonDocument cannot deserialize documents above 4mb in size Created: 04/Dec/13  Updated: 02/Apr/15  Resolved: 06/Dec/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.8.3
Fix Version/s: 1.9

Type: Bug Priority: Minor - P4
Reporter: Nate Buwalda Assignee: Sridhar Nanjundeswaran
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7, Mongo 2.4.6, .Net 4.5



 Description   

We were experimenting with LazyBsonDocument to try to address a memory issue that we are having in our application. We encountered the following exception when trying to read one of our larger documents (~10 mb):

Unhandled Exception: System.IO.FileFormatException: Size 10891020 is not valid because it is larger than MaxDocumentSize 4194304.
  at MongoDB.Bson.IO.BsonBinaryReader.ReadSize() in c:\projects\mongo-csharp-driver\MongoDB.Bson\IO\BsonBinaryReader.cs: line 706

In reviewing the source for LazyBsonDocument, it looks like its BinaryBsonReader settings are using the defaults instead of the server configuration. The defaults appear to be set to 4mb (in BsonDefaults).



 Comments   
Comment by Githook User [ 06/Dec/13 ]

Author:

{u'username': u'sridharn', u'name': u'Sridhar Nanjundeswaran', u'email': u'sridhar@10gen.com'}

Message: CSHARP-866 - Use size of slice as MaxDocumentSize when deserializing a LazyBsonArray or LazyBsonDocument
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/a80f42e8a139874b7cfaf8c995c6947010e5cab2

Generated at Wed Feb 07 21:38:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.