Documentation

API

JSON schema documentation for the platform contracts. Select a schema from the left list to inspect its structure and fields.

CollectionSchema

Represents a MongoDB collection definition

type: object

Aperçu

Type
object
Required
["_id","collectionName","label","tenantId","websiteId","relations","indexes","currentSchemaVersion","schemaVersions","description"]

Détails du schéma

descriptionstringrequired

Description of the collection. Must be complete and in markdown format. Usage mainly for ai agents to understand the collection.

Type
string
tenantIdstringrequired

The unique identifier of the tenant/organization that owns this collection

Type
string
websiteIdstringrequired

The ID of the website this collection belongs to

Type
string
labelstringrequired

The label of the collection, used for display purposes

Type
string
_idstringrequired

The unique identifier for the collection as uuid

Type
string
collectionNamestringrequired

The unique key for the collection, used in queries

Type
string
relationsArray<object>required

Array of relationships between this collection and other collections

Type
Array<object>
indexesArray<object>required

Array of valid MongoDB index definitions for the collection

Type
Array<object>
schemaVersionsArray<object>required

Array of versioned schemas for the collection

Type
Array<object>
currentSchemaVersionstringrequired

The version identifier (e.g., '1.0.0') of the currently active schema version for this collection

Type
string
additionalProperties: false
Voir le JSON brut
{
  "title": "CollectionSchema",
  "description": "Represents a MongoDB collection definition",
  "type": "object",
  "properties": {
    "description": {
      "type": "string",
      "description": "Description of the collection. Must be complete and in markdown format. Usage mainly for ai agents to understand the collection."
    },
    "tenantId": {
      "type": "string",
      "description": "The unique identifier of the tenant/organization that owns this collection"
    },
    "websiteId": {
      "type": "string",
      "description": "The ID of the website this collection belongs to"
    },
    "label": {
      "type": "string",
      "description": "The label of the collection, used for display purposes"
    },
    "_id": {
      "type": "string",
      "description": "The unique identifier for the collection as uuid"
    },
    "collectionName": {
      "type": "string",
      "description": "The unique key for the collection, used in queries"
    },
    "relations": {
      "type": "array",
      "description": "Array of relationships between this collection and other collections",
      "items": {
        "type": "object",
        "properties": {
          "localField": {
            "type": "string",
            "description": "The name of the local field used for the relationship"
          },
          "foreignCollection": {
            "type": "string",
            "description": "The name of the foreign collection being referenced"
          },
          "foreignField": {
            "type": "string",
            "description": "The name of the field in the foreign collection used for the relationship"
          },
          "type": {
            "type": "string",
            "enum": [
              "one-to-one",
              "one-to-many",
              "many-to-one",
              "many-to-many"
            ],
            "description": "The type of relationship between collections"
          },
          "as": {
            "type": "string",
            "description": "Local alias name for accessing this relationship"
          }
        },
        "required": [
          "localField",
          "foreignCollection",
          "foreignField",
          "type",
          "as"
        ],
        "additionalProperties": false
      },
      "required": [
        "localField",
        "foreignCollection",
        "foreignField",
        "type",
        "as"
      ],
      "additionalProperties": false
    },
    "indexes": {
      "type": "array",
      "description": "Array of valid MongoDB index definitions for the collection",
      "items": {
        "type": "object",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "collection": {
                "type": "string",
                "description": "The name of the collection this index belongs to",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "enum": [
                  "text"
                ],
                "description": "The type of index (text index for full-text search)"
              },
              "name": {
                "type": "string",
                "description": "Unique name identifier for this index",
                "minLength": 1
              },
              "fields": {
                "type": "array",
                "description": "Array of field definitions included in this text index",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "properties": {
                    "fieldName": {
                      "type": "string",
                      "description": "The name of the field to be indexed",
                      "minLength": 1
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "1",
                        "-1",
                        "text",
                        "2dsphere"
                      ],
                      "description": "The index type: '1' for ascending, '-1' for descending, 'text' for text search, '2dsphere' for geospatial"
                    }
                  },
                  "required": [
                    "fieldName",
                    "type"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "collection",
              "kind",
              "fields",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "collection": {
                "type": "string",
                "description": "The name of the collection this search index belongs to",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "enum": [
                  "search"
                ],
                "description": "The type of index (Atlas Search index for advanced search capabilities)"
              },
              "name": {
                "type": "string",
                "description": "Unique name identifier for this search index",
                "minLength": 1
              },
              "definition": {
                "type": "object",
                "description": "The MongoDB Atlas Search index definition configuration object",
                "additionalProperties": false
              }
            },
            "required": [
              "collection",
              "kind",
              "name"
            ],
            "additionalProperties": false
          }
        ]
      },
      "additionalProperties": false
    },
    "schemaVersions": {
      "type": "array",
      "description": "Array of versioned schemas for the collection",
      "items": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "Schema version (e.g., '1.0.0', '2.1.0')"
          },
          "schema": {
            "type": "object",
            "description": "The JSON schema definition that validates documents in this collection version",
            "additionalProperties": false
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether this version is currently active"
          },
          "description": {
            "type": "string",
            "description": "Description of changes in this version"
          },
          "isDefault": {
            "type": "boolean",
            "description": "Whether this is the default version for new documents"
          }
        },
        "required": [
          "version",
          "isActive",
          "isDefault",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "currentSchemaVersion": {
      "type": "string",
      "description": "The version identifier (e.g., '1.0.0') of the currently active schema version for this collection"
    }
  },
  "additionalProperties": false,
  "required": [
    "_id",
    "collectionName",
    "label",
    "tenantId",
    "websiteId",
    "relations",
    "indexes",
    "currentSchemaVersion",
    "schemaVersions",
    "description"
  ]
}