Get a schema

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

Get a specific schema by its _id value.

Path parameters

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • metadata object

      Metadata that describes which linked collection the schema applies to.

      Hide metadata attributes Show metadata attributes object
      • data_source string

        The data source name.

      • database string

        The database name.

      • collection string

        The collection name.

    • schema object

      A valid schema for the collection.

      Hide schema attributes Show schema attributes object
      • bsonType string

        The BSON type of the field.

        Values are object, array, string, number, int, long, double, decimal, date, timestamp, bool, null, regex, objectId, binary, uuid, function, javascript, symbol, minKey, or maxKey.

      • title string

        A human-readable title for the schema.

      • required array[string]

        For object schemas, an array of field names that are required in instances of the object.

      • properties object

        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 Show properties attribute object
        • * object

          A valid schema for the collection.

    • relationships object

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

      Hide relationships attribute Show relationships attribute object
      • * object Additional properties

        A relationship definition.

        Hide * attributes Show * attributes object
        • ref string

          A reference string for the foreign collection.

        • foreign_key string

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

        • is_list boolean

          If true:

          • the relationship may point to many foreign documents.
          • the local field must be defined as an array in the collection schema.
GET /groups/{groupId}/apps/{appId}/schemas/{schemaId}
curl \
 --request GET 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/schemas/{schemaId}' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "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
    }
  }
}