BSON file size

273 views
Skip to first unread message

Stephen Yee

unread,
Mar 20, 2019, 12:39:54 PM3/20/19
to BSON
Hi,

I'm considering using BSON to serialize some data in my application.

From reading the spec, it looks like the first 4 bytes of the file are interpreted as the total size, in bytes, of the bson document.  Does this limit the total size of any one file to 2,147,483,647 bytes (i.e. the max value of an int32)?

Thanks

Andrew Morrow

unread,
Mar 20, 2019, 1:46:34 PM3/20/19
to bs...@googlegroups.com

Hi -

Yes, that is correct. The total size of any one BSON document is limited to 2^31-1 bytes.

Note that MongoDB imposes much smaller document limits internally (see https://docs.mongodb.com/manual/reference/limits/), so if you ever intend for your BSON documents to be stored in MongoDB you must keep them under 16MB.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "BSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bson+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Yee

unread,
Mar 20, 2019, 2:32:44 PM3/20/19
to BSON
Ok thanks Andrew
Reply all
Reply to author
Forward
0 new messages