Skip to main content

Class: TableDefinition<Document, FieldPaths, TableIndexes>

schema.TableDefinition

The definition of a table within a schema.

This should be produced by using defineTable.

Type parameters

NameType
Documentextends GenericDocument = GenericDocument
FieldPathsextends string = string
TableIndexesextends GenericTableIndexes = {}

Methods

index

index<IndexName, FirstFieldPath, RestFieldPaths>(name, fields): TableDefinition<Document, FieldPaths, Expand<TableIndexes & Record<IndexName, [FirstFieldPath, ...RestFieldPaths[]]>>>

Define an index on this table.

To learn about indexes, see Defining Indexes.

Type parameters

NameType
IndexNameextends string
FirstFieldPathextends string
RestFieldPathsextends FieldPaths[]

Parameters

NameTypeDescription
nameIndexNameThe name of the index.
fields[FirstFieldPath, ...RestFieldPaths[]]The fields to index, in order. Must specify at least one field.

Returns

TableDefinition<Document, FieldPaths, Expand<TableIndexes & Record<IndexName, [FirstFieldPath, ...RestFieldPaths[]]>>>

A TableDefinition with this index included.