client.schema. This module allows you to programmatically retrieve the definitions of your collections, which is useful for building dynamic forms or data table components.
getSchema
Fetch the schema definition for a specific collection.CollectionSchema)
| Field | Type | Description |
|---|---|---|
name | string | The name of the collection. |
model | SchemaField[] | Array of field definitions. |
SchemaField Object
| Field | Type | Description |
|---|---|---|
key | string | The field name. |
type | string | The Mongoose type (e.g. "String", "Number", "Ref", "Array"). |
required | boolean | Whether the field is mandatory. |
unique | boolean | Whether the field has a uniqueness constraint. |
ref | string | If type is "Ref", the target collection name. |
items | object | Element type definition when type is "Array". Contains type and optional nested fields. |
fields | SchemaField[] | Nested field definitions for embedded objects or sub-documents. |
