UNPKG

@geekbears/gb-mongoose-keywords-plugin

Version:
26 lines (25 loc) 741 B
import { Document } from 'mongoose'; /** * An interface for Documents with keywords * * @remarks based on Mongoose's `Document` type * * @usage define the model document type by joining this interface with the schema class * ```typescript * export type ExampleDocument = Example & IKeywordedDocument; * ``` */ export interface IKeywordedDocument extends Document<any> { /** * An array containing this document's generated keywords */ __keywords: string[]; /** * Generate and extract keywords based on the preconfigured schema parameters */ __generateKeywords(): Promise<string[]>; /** * Generate and save this documents keywords */ __generateAndSaveKeywords(): Promise<void>; }