Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-5093

Opening a collection that has JSON schema validation fires off expensive query in the background

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical - P2 Critical - P2
    • 1.36.0
    • None
    • UI / UX
    • None
    • 5
    • Needed
    • Hide

      Schema Validation documentation mentions that the validation updates in real time:

      > As you edit your validation, Compass updates in real-time to display a document from your collection that passes the validation and a document that fails.

      This will not be happening anymore, you would need to press the button to get the preview documents that pass or fail validation

      Show
      Schema Validation documentation mentions that the validation updates in real time: > As you edit your validation, Compass updates in real-time to display a document from your collection that passes the validation and a document that fails. This will not be happening anymore, you would need to press the button to get the preview documents that pass or fail validation
    • Iteration Turtle, Iteration Unicornfish

    Description

      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.

      Attachments

        Activity

          People

            himanshu.singh@mongodb.com Himanshu Singh
            juan.soto@mongodb.com Juan Soto (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: