-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
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.
- documents
-
SERVER-60708 db.collection.validate() returns `nInvalidDocuments: 0` when invalid documents are present
- Closed