本文整理匯總了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;
}