UNPKG

@geekbears/gb-mongoose-keywords-plugin

Version:
23 lines (22 loc) 899 B
import { Schema } from 'mongoose'; import { IKeywordOptions } from './interfaces'; /** * Add keyword generation for a given schema * * @description * Automatically generates keywords from the specified local and virtual paths and persists * them into a new `__keywords` field. * * @usage * Pass an object with the following options to configure the behavior of keyword generation. * * Available options are: * - `paths`: a collection of the local schema paths to generate keywords from * - `virtuals`: a map of virtual paths to be populated and generate keywords from * - `omit`: a collection of words to be omitted from the resulting keywords * * @remarks * Keywords will be generated automatically when creating a new document or updating an existing * one via `findOneAndUpdate` */ export declare const KeywordsMiddleware: (schema: Schema, options: IKeywordOptions) => void;