BSONObj size: 24720183 (0x1793337) is invalid. Size must be between 0 and 16793600(16MB)

Hi Guys,
I am using Mongo Version 4.4 and Debezium 2.1.
I need to move all the data from mongo 4.4 to mongo 7.
Once i started the connector and got the following error :

Caused by: com.mongodb.MongoCommandException: Command failed with error 10334 (BSONObjectTooLarge): ‘BSONObj size: 24720183 (0x1793337) is invalid. Size must be between 0 and 16793600(16MB) First element: _id: { _data: “XXX” }’ on server db-mongo-X.X.X.net:27017.

How can i fix this issue ? break this documents into pieces ? this is an invalid document? can i repair it ?

Hi Bar,

Yes, you’ll need to move or break apart the document that is invalid. The maximum document size is 16 MB https://www.mongodb.com/docs/manual/reference/limits/#mongodb-limit-BSON-Document-Size .

For migrating from MongoDB 4.4 to 7.0, do you have separate instances setup and are copying data between them? Or are you updating in place? I ask because that is a big jump in terms of major versions.