UNPKG

mongodb-data-service

Version:
40 lines 1.6 kB
import type { IndexDescriptionInfo } from 'mongodb'; export type IndexInfo = { ns?: string; name: string; key: Record<string, string | number>; v: number; [key: string]: unknown; }; export type IndexStats = { name: string; usageCount?: number; usageHost?: string; usageSince?: Date; }; type IndexSize = number; export type IndexDefinition = { ns: string; name: string; key: IndexInfo['key']; version: number; fields: { field: string; value: number | string; }[]; type: 'regular' | 'geospatial' | 'hashed' | 'text' | 'wildcard' | 'clustered' | 'columnstore'; cardinality: 'single' | 'compound'; properties: ('unique' | 'sparse' | 'partial' | 'ttl' | 'collation')[]; extra: Record<string, string | number | boolean | Record<string, any>>; size: IndexSize; relativeSize: number; buildProgress: number; } & IndexStats; export declare function getIndexCardinality(index: Pick<IndexDefinition, 'key' | 'fields' | 'extra'>): IndexDefinition['cardinality']; export declare function getIndexProperties(index: Pick<IndexDefinition, 'name' | 'key' | 'fields' | 'extra'>): IndexDefinition['properties']; export declare function getIndexType(index: Pick<IndexDefinition, 'extra' | 'key'>): IndexDefinition['type']; export declare function createIndexDefinition(ns: string, { name, key, v, ...extra }: IndexDescriptionInfo & { name: string; }, indexStats?: IndexStats, indexSize?: number, maxSize?: number, buildProgress?: number): IndexDefinition; export {}; //# sourceMappingURL=index-detail-helper.d.ts.map