本文整理汇总了TypeScript中mongodb.Collection.deleteOne方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Collection.deleteOne方法的具体用法?TypeScript Collection.deleteOne怎么用?TypeScript Collection.deleteOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mongodb.Collection
的用法示例。
在下文中一共展示了Collection.deleteOne方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
return new Promise<void>((resolve, reject) => {
this._collection.deleteOne({ userid: userid }).then(() => {
resolve()
}).catch((err) => {
reject(new Error('Could not remove user: ' + err.message))
})
})
示例2: resolve
return new Promise<void>((resolve, reject) => {
this._collection.deleteOne({ name: name }).then(() => {
resolve()
}).catch((err) => {
reject(new Error('Could not remove challenge: ' + err.message))
})
})
示例3:
Promise.all(updates.map(update => {
if (update.method === 'add') {
return col.insertOne(update.racer);
} else {
return col.deleteOne({id: update.id});
}
})).then(() => process.send('update'));
示例4: purge_signature
export function purge_signature(coll: Collection, signature: string): Promise<DeleteWriteOpResultObject> {
return coll.deleteOne({signature});
}
示例5: purge
export function purge(coll: Collection, id: UUID): Promise<DeleteWriteOpResultObject> {
return coll.deleteOne({id});
}
示例6: remove
public async remove(id: string): Promise<void> {
await this.collection.deleteOne({__id: id});
}
示例7: deleteUser
async deleteUser(id: string) {
await this.users.deleteOne({ _id: new ObjectId(id) });
}