UNPKG

mongocat

Version:

✨ Mongocat 😺 is easy to use, configuration based Denormalization mongoose plugin for read heavy applications. Mongocat reduces write complexity too.

72 lines (71 loc) 1.84 kB
import { Schema } from 'mongoose'; export interface IProvider { toRef?: string; keyFields?: string[]; ignoredFields?: string[]; } export interface IConsumer { fromRef: string; toPath?: string; key?: string; as?: Record<string, any>; inArray?: boolean; withTimestamp?: boolean; toRef?: string; } export interface IWatchConsumer { changeStreamEnabled?: boolean; key?: string; fromRef: string; toPath?: string; inArray?: boolean; strict?: boolean; exceptionOnFailure?: boolean; toRef: string; } export interface IPolymorphicConsumer { availableProviders?: string[]; localKey?: string; foreignKey?: string; toRef: string; fromRefPath?: string; fixedProvider?: string; denormWhen?: { field: string; is?: string[]; ne?: string[]; in?: string[]; nin?: string[]; }; toPath: string; morphSchemaMap?: Record<string, Schema>; modelSwitcher?: Record<string, string>; withTimestamp?: boolean; clean?: boolean; strict?: boolean; inArray?: boolean; polymorphic?: boolean; exceptionOnFailure?: boolean; as?: Record<string, string>; changeStreamEnabled?: boolean; morphKey?: string; fromRef?: string; } export interface IPolymorphicArrayConsumer { toPathNestedField: string; availableProviders?: string[]; localKey?: string; foreignKey?: string; toRef: string; fromRefPath?: string; fixedProvider?: string; toPath: string; morphSchemaMap?: Record<string, Schema>; withTimestamp?: boolean; clean?: boolean; strict: boolean; inArray?: boolean; as?: Record<string, string>; changeStreamEnabled?: boolean; polymorphic?: boolean; }