[DOCS-15206] Investigate changes in SERVER-60708: db.collection.validate() returns `nInvalidDocuments: 0` when invalid documents are present Created: 31/Mar/22  Updated: 13/Nov/23  Resolved: 15/Apr/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 6.0.0-rc0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Jocelyn Mendez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-60708 db.collection.validate() returns `nIn... Closed
Participants:
Days since reply: 1 year, 42 weeks, 5 days ago
Epic Link: DOCSP-19446

 Description   
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.



 Comments   
Comment by Githook User [ 15/Apr/22 ]

Author:

{'name': 'jocelyn-mendez1', 'email': '91144778+jocelyn-mendez1@users.noreply.github.com', 'username': 'jocelyn-mendez1'}

Message: DOCS-15206 nNonCompliantDocuments field added to validate output (#955)

  • DOCS-15206 nNonCompliantDocuments field added to validate output

Co-authored-by: Jocelyn Mendez <jocelyn.mendez@Jocelyns-MacBook-Pro.local>
Branch: master
https://github.com/10gen/docs-mongodb-internal/commit/e8b4d870c81df68e73e2b8507a59d7e6f39090a3

Comment by Jess Mokrzecki [ 31/Mar/22 ]

Fix Version updated for upstream SERVER-60708:
6.0.0-rc0

Generated at Thu Feb 08 08:12:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.