PUT /groups/{groupId}/apps/{appId}/schemas/{schemaId}

Reemplaza un esquema existente con uno nuevo.

Parámetros de path

aplicación/json

Cuerpo Requerido

  • metadata Objeto

    Metadata that describes which linked collection the schema applies to.

    Hide metadata attributes Mostrar los atributos de metadatos Objeto
    • data_source string

      The data source name.

    • database string

      El nombre de la base de datos.

    • Colección string

      El nombre de la colección.

  • esquema Objeto

    A valid schema for the collection.

    Ocultar atributos del esquema Show schema attributes Objeto
    • bsonType string

      The BSON type of the field.

      Los valores son object, array, string, number, int, long, double, decimal, date, timestamp, bool, null, regex, objectId, binary, uuid, function, javascript, symbol, minKey o maxKey.

    • Título string

      A human-readable title for the schema.

    • Requerido array[string]

      Para los esquemas object, un arreglo de nombres de campos que son obligatorios en instancias del objeto.

    • Propiedades Objeto

      An object where each field name is a property in the schema. The corresponding value is a schema definition for that field.

      Hide properties attribute Mostrar atributo de propiedades Objeto
      • * Objeto

        A valid schema for the collection.

  • relaciones Objeto

    Relationships to foreign collections. Each field name is a property in the schema. The corresponding value is a relationship definition for that field.

    Ocultar el atributo de relaciones Show relationships attribute Objeto
    • * Objeto Propiedades adicionales

      A relationship definition.

      Ocultar * atributos Mostrar * atributos Objeto
      • ref string

        Una string de referencia para la colección externa.

      • foreign_key string

        The name of the field in the foreign collection that the relationship points to.

      • es_lista booleano

        En caso de que true:

        • the relationship may point to many foreign documents.
        • the local field must be defined as an array in the collection schema.

Respuestas

  • 204

    Sin contenido

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}}}'
Solicitar ejemplos
{
  "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
    }
  }
}