Knowing that mongoDB has 16MB data size per document, we are using file system to store such data, but some how in mongodb, there are bson date larger than 16 mb, as a part of correction, we want to identify those _id and delete it. how can we find the id that has more then 16mb bson size.
I can find the largest size of the document from the following query.. But want to find the number of large size documents in the collection
var max = 0, id = null;
db.Email_Notification_log.find().forEach(doc => {
const size = Object.bsonsize(doc);
if(size > max) {
max = size;
id = doc._id;
}
});
print(id, max);
It is mongodb ver 4.0.4 and its a standalone, it is crashing the mongodb service when i run this query..