Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-15206

Investigate changes in SERVER-60708: db.collection.validate() returns `nInvalidDocuments: 0` when invalid documents are present

      Original Downstream Change Summary

      If validation action is:

      warn, then validate will only populate the warnings list. This was also the default and only behaviour prior to this change.

      error, then validate will populate the errors list and set valid to false.

      In both cases, the new nNonCompliantDocuments field will contain the number of non-compliant documents. If there are better names, I'm open to suggestions. I didn't want to use nInvalid as that's counting the number of corrupt documents.

      Description of Linked Ticket

      If I create a collection with validationLevel: strict and validationAction: warn, and subsequently run db.collection.validate() on a collection containing invalid documents, I would expect the number of invalid documents and the warnings array to be populated

      However, running `db.collection.validate()` on a collection with invalid documents returns unexpected results:

      • nInvalidDocuments is 0
      • and no messages present in the warnings[] or errors[] array

      The logs for the server do log the errors, but the errors are not reflected in the output to db.collection.validate().

      If I use validationAction: error, then execute `db.collection.validate()`, there is a warning present in warnings[] but nInvalidDocuments is still 0.

            Assignee:
            jocelyn.mendez@mongodb.com Jocelyn Mendez
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 1 week ago