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: [
Unknown macro: { md5}
, { md5:
{ $exists: false }
} ] }, { $or: [
Unknown macro: { sha1}
, { sha1:
{ $exists: false }
} ] }, { $or: [
Unknown macro: { sha256}
, { 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
This query should be triggered only if the users wants to execute. We should have some UI button to trigger this queries or something similar to the aggregate tab with sample docs. Or at least aggregation should use sample of 1000 docs.
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.
|