Generate a JSON schema from sample

POST /groups/{groupId}/apps/{appId}/services/{serviceId}/commands/generate_schema

Sample a subset of documents in a collection to generate a JSON schema.

Path parameters

application/json

Body Required

  • database_name string Required

    The name of the database that contains the collection.

  • collection_name string Required

    The name of the collection to sample and generate a schema for.

  • limit integer Required

    The maximum number of documents to include in the sample.

Responses

  • 200 application/json

    Successfully generated schema

    Hide response attribute Show response attribute object
    • schema object

      The generated JSON schema

POST /groups/{groupId}/apps/{appId}/services/{serviceId}/commands/generate_schema
curl \
 --request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/services/{serviceId}/commands/generate_schema' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"database_name":"string","collection_name":"string","limit":42}'
Request examples
{
  "database_name": "string",
  "collection_name": "string",
  "limit": 42
}
Response examples (200)
{
  "schema": {}
}