I have two questions about performing document validation:
-
Can you perform the equivalent of mongosh db.collection.validate() from a driver (I happen to be using the latest Go driver)? The Go driver provides Database.RunCommand(…) but I don’t see how to run an administrative command on an individual collection. I’m probably missing something obvious.
-
When a collection contains invalid documents, what is the expected output when running db.collection.validate(), specifically values for nInvalidDocuments, warnings, or errors? If I have a collection with invalid documents (validationLevel: strict, validationAction: warn) and I run db.collection.validate(), the response does not indicate any errors at all: nInvalidDocuments is 0, and warnings and errors are empty. Yet, I know validation was performed because the server logs indicate the result of the validation command had invalid docs. Does this sound like a bug or are my expectations incorrect?
Thanks!
Elliot