本文整理汇总了TypeScript中@utils.IModel类的典型用法代码示例。如果您正苦于以下问题:TypeScript IModel类的具体用法?TypeScript IModel怎么用?TypeScript IModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IModel类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: removeById
public removeById(id: any): Promise<T> {
return this._model.findByIdAndRemove(id).exec();
}
示例2: remove
public remove(query: any): Promise<T> {
return this._model.remove(query).exec();
}
示例3: findById
public findById(id: any): Promise<T> {
return this._model.findById(id).exec();
}
示例4: size
public async size(): Promise<number> {
return this._model.count({}).exec();
}
示例5: findPaginated
public findPaginated(query: Query<T>, pagination: PaginateOptions): Promise<PaginateResult<T>> {
return this._model.paginate(query, pagination);
}
示例6: findOne
public findOne(query: any): Promise<T> {
return this._model.findOne(query).exec();
}
示例7: getFields
public getFields(query: any, fields: any): Promise<any> {
return this._model.find(query).select(fields).exec();
}
示例8: getFieldsById
public getFieldsById(id: any, fields: any): Promise<any> {
return this._model.findById(id).select(fields).exec();
}
示例9: contains
public async contains(query: any): Promise<boolean> {
return (await this._model.paginate(query, {limit: 0})).total > 0;
}