v50

latestOpenAPI 3.1.0raw.githubusercontent.com2025-06-09181183330.0 KB
schemas

Sample & Validate Documents

Query a subset of documents in a collection and validate each match against a schema.

post/groups/{groupId}/apps/{appId}/services/{datasourceId}/commands/validate_documents

Request body

database_namestring required

The name of the database that contains the collection to validate.

collection_namestring required

The name of the collection to validate.

from_schemaobject required

The EJSON schema to validate sampled documents against.

queryobject

A MongoDB query that matches documents in the collection. The result of running this query is the sample population. Use this to narrow the sample to a subset of documents in the collection.

limitnumber

The maximum number of documents to sample.

sortobject

A MongoDB sort for the collection. Use this to determine which end of a range query to start sampling from.

Response

OK

total_processed_countnumber

The total number of documents that were sampled.

total_error_countnumber

The total number of documents that failed any validation.

Example response

{
  "errors": [
    {
      "field": "(root)._id"
    }
  ]
}