Update a schema
Replace an existing schema with a new one.
Path parameters
-
An Atlas Project/Group ID.
-
The ObjectID of your application. The App Services API Project and Application IDs section demonstrates how to find this value.
-
The unique
_id
value of a schema.
Body
Required
-
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.
PUT
/groups/{groupId}/apps/{appId}/schemas/{schemaId}
curl \
--request PUT 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/schemas/{schemaId}' \
--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}}}'
Request examples
{
"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
}
}
}