Skip to main content

Indexes

WIP#

Single Index#

import { GtDocument, GtModel } from '@pebula/goosetyped';
@GtDocument()
export class Person extends GtModel() {
@GtIndex({ sort: 'asc' })
@GtColumn()
name: string;
@GtIndex({ sort: 'desc' })
@GtColumn()
age: number;
@GtIndex() // defaults to 'asc'
@GtColumn()
nickname: string;

Metadata: GtSingleIndexMetadataArgs

Compound Index#

import { GtDocument, GtModel } from '@pebula/goosetyped';
@GtIndex({
indices: {
name: 'asc';
nickname: 'desc';
},
options: {
test: true,
}
})
@GtDocument()
export class Person extends GtModel() {
@GtColumn()
name: string;
@GtColumn()
age: number;
@GtColumn()
nickname: string;

Metadta: GtCompoundIndexMetadataArgs