Query a subset of documents in a collection and validate each match against a schema.
Parámetros de path
-
An Atlas Project/Group ID.
-
El ObjectID de tu aplicación. La sección de ID de Proyecto y ID de la aplicación de App Services API muestra cómo encontrar este valor.
-
El valor único
_idde una fuente de datos MongoDB.
Cuerpo
Requerido
-
The name of the database that contains the collection to validate.
-
The name of the collection to validate.
-
El esquema EJSON con el que validar los documentos muestreados.
-
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.
Default value is
{}(empty). -
The maximum number of documents to sample.
El valor por defecto es
10000. -
Un ordenamiento de MongoDB para la colección. Utilice esto para determinar desde qué extremo de una query de rango debe iniciar el muestreo.
Default value is
{}(empty).
curl \
--request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/services/{datasourceId}/commands/validate_documents' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"database_name":"string","collection_name":"string","from_schema":{},"query":{},"limit":10000,"sort":{}}'
{
"database_name": "string",
"collection_name": "string",
"from_schema": {},
"query": {},
"limit": 10000,
"sort": {}
}
{
"errors": [
{
"error_code": "false",
"error_count": 42.0,
"field": "(root)._id",
"failed_ids": [
"string"
],
"failed_documents_query": {}
}
],
"total_processed_count": 42.0,
"total_error_count": 42.0
}