In MongoDB, using Java how can I query to find documents which exceeds the 15mb size in database or collection
CodePudding user response:
Try this one:
db.collection.aggregate([
{ $set: { size: { $bsonSize: "$$ROOT" } } },
{ $match: { size: { $gt: 15 * 1024 * 1024 } } }
])