Define a new schema for a linked collection. When creating a schema with this endpoint, ensure that the JSON payload is completely unescaped. Incorrectly escaped JSON formats can lead to errors.
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.
Metadata that describes which linked collection the schema applies to.
A valid schema for the collection.
Relationships to foreign collections. Each field name is a property in the schema. The corresponding value is a relationship definition for that field.
curl \
--request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/schemas' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"metadata": {
"data_source": "string",
"database": "string",
"collection": "string"
},
"schema": {
"bsonType": "object",
"title": "string",
"required": [
"string"
],
"properties": {
"*": {}
}
},
"relationships": {
"additionalProperty1": {
"ref": "string",
"foreign_key": "string",
"is_list": true
},
"additionalProperty2": {
"ref": "string",
"foreign_key": "string",
"is_list": true
}
}
}'
{
"metadata": {
"data_source": "string",
"database": "string",
"collection": "string"
},
"schema": {
"bsonType": "object",
"title": "string",
"required": [
"string"
],
"properties": {
"*": {}
}
},
"relationships": {
"additionalProperty1": {
"ref": "string",
"foreign_key": "string",
"is_list": true
},
"additionalProperty2": {
"ref": "string",
"foreign_key": "string",
"is_list": true
}
}
}
{
"_id": "string",
"metadata": {
"data_source": "string",
"database": "string",
"collection": "string"
}
}