UNPKG

@aequum/mongoose

Version:

aequum mongoose tools for repository, pagination, CRUD/CRUDL, configs and utils

15 lines (14 loc) 1.67 kB
import { ApplySchemaOptions, DefaultSchemaOptions, FlatRecord, HydratedDocument, Model, ObtainDocumentType, ResolveSchemaOptions, Schema, SchemaDefinition, SchemaDefinitionType, SchemaOptions } from 'mongoose'; export declare function schemaTransformsForVirtualID<TClass = any>(schema: Schema<TClass>, toJSONOptions?: SchemaOptions['toJSON'], toObjectOptions?: SchemaOptions['toObject'], removeVersion?: boolean): Schema<TClass>; /** * Mongoose Schema with a virtual `id` property * combine with `schemaTransformsForVirtualID` * to remove `_id` and `__v` properties. * * @see {@link schemaTransformsForVirtualID} */ export declare class SchemaWithVirtualID<RawDocType = any, TModelType = Model<RawDocType, any, any, any>, TInstanceMethods = {}, TQueryHelpers = {}, TVirtuals = {}, TStaticMethods = {}, TSchemaOptions = DefaultSchemaOptions, DocType extends ApplySchemaOptions<ObtainDocumentType<DocType, RawDocType, ResolveSchemaOptions<TSchemaOptions>>, ResolveSchemaOptions<TSchemaOptions>> = ApplySchemaOptions<ObtainDocumentType<any, RawDocType, ResolveSchemaOptions<TSchemaOptions>>, ResolveSchemaOptions<TSchemaOptions>>, THydratedDocumentType = HydratedDocument<FlatRecord<DocType>, TVirtuals & TInstanceMethods, {}, TVirtuals>> extends Schema<RawDocType, TModelType, TInstanceMethods, TQueryHelpers, TVirtuals & { id: string; }, TStaticMethods, TSchemaOptions, DocType, THydratedDocumentType> { constructor(definition?: SchemaDefinition<SchemaDefinitionType<RawDocType>, RawDocType, THydratedDocumentType> | DocType, options?: SchemaOptions<FlatRecord<DocType>, TInstanceMethods, TQueryHelpers, TStaticMethods, TVirtuals, THydratedDocumentType>); }