I want to use schema validation to validate my documents in mongo db collections. I applied a schema and the run await this.db.command({ validate: collectionName, full: true });
in my NodeJS app. For example, if there are documents which have fields not listed in the schema, they are counted in nNonCompliantDocuments
. There is also a messageg "Detected one or more documents not compliant with the collection's schema. Check logs for log id 5363500."
. I’m wondering if there is a way to get the invalid (or not compliant) document using nodejs.