I have a collection which contains a multiple documents whose size has increased from 16MBs or is about to reach 16MBs. I want query that finds documents which have size greater than 10MBs and delete all of them.
I am using following to find the size of document.
Object.bsonsize(db.test.findOne({type:"auto"}))
Is there a way to embed this query inside db.test.deleteMany() query?