Problem Statement/Rationale
I have some very large collections (billions of documents) that have JSON schema validation in place. If I open one of these collections in Compass, even if I don't click on the Validation tab it still fires off a very expensive query in the background to apparently find any documents that don't validate, e.g.
{ aggregate: \"mycollection\", pipeline: [ { $match: { $and: [ { $or: [ { md5: { $type: \"string\", $regex: \"^[a-f0-9]{32}$\" } }, { md5: { $exists: false } } ] }, { $or: [ { sha1: { $type: \"string\", $regex: \"^[a-f0-9]{40}$\" } }, { sha1: { $exists: false } } ] }, { $or: [ { sha256: { $type: \"string\", $regex: \"^[a-f0-9]{64}$\" } }, { sha256: { $exists: false } } ] } ] } ] } }, { $group: { _id: 1, n: { $sum: 1 } } } ], c..."
|
Steps to Reproduce
Create a collection with some data. Add JSON schema validation. Open the collection to the Documents tab in Compass and watch the query get fired off using db.currentOp().
Expected Results
Really this should never happen as with any collections of significant size this is going to cause an issue. I'm not sure what it's trying to populate in the UI, but it's probably better to allow the user to initiate an action to pull this result. At the very least, it shouldn't happen until I open the Validation tab, so that I can avoid it by just not going into that part of the UI.
Actual Results
Even just opening the Documents tab of the collection in Compass causes this very expensive scan of the entire dataset.
Additional Notes
Any additional information that may be useful to include.
|