本文整理匯總了TypeScript中mongoose.Model.remove方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Model.remove方法的具體用法?TypeScript Model.remove怎麽用?TypeScript Model.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mongoose.Model
的用法示例。
在下文中一共展示了Model.remove方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve: (res: boolean) => void, rejected: (err?: any) => void) => {
this.userModel.remove(by, (err) => {
if (!err) {
resolve(true);
} else {
rejected(err);
}
});
});
示例2: delete
delete(_id: string, callback: (error: any, result: any) => void) {
this._model.remove({ _id: this.toObjectId(_id) }, (err: any) => callback(err, null));
}
示例3: removeSkipingHooks
removeSkipingHooks(data: T) {
this.Model.remove(data, (err: any) => {});
}
示例4: errorCb
removeDocuments<T extends Document>(model: Model<T>, filter: any, errorCb: (err: any) => void, successCb: () => void) {
model.remove(filter, (err: any) => {
err ? errorCb(err) : successCb();
});
}
示例5: remove
public remove(by: Object): Promise<{}> {
return this.model.remove(by).exec() as any as Promise<{}>;
}