fakemongo / fongo

faked out in-memory mongo for java
Apache License 2.0
523 stars 155 forks source link

BSON max size not respected in fongo #335

Open kwujec opened 6 years ago

kwujec commented 6 years ago

Hi, I don't know if its intentional, but Fongo is not throwing an exception when bson is larger than 16megabytes. In mongo documentation: The maximum BSON document size is 16 megabytes. When i connect in my test to real mongo instance and i am trying to save Bson that is larger that 16mb, mongo throwing an Exception like: org.bson.BsonSerializationException: Document size of 17000268 is larger than maximum of 16793600.

Fongo just save it without a problem. I tried save Documents up to 90mb. It will be nice to have this exception also in Fongo.

My versions: Fongo: 2.2.0-RC1 Mongo java driver: 3.6.3

Best regards!