mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-14 12:09:04 +08:00
Add findByIdAndDelete() method (#28893)
findByIdAndDelete() recommended method is missing. Mongoose docs: https://mongoosejs.com/docs/api.html#model_Model.findByIdAndDelete MongoDb docs: https://docs.mongodb.com/manual/reference/method/db.collection.findOneAndDelete/
This commit is contained in:
18
types/mongoose/index.d.ts
vendored
18
types/mongoose/index.d.ts
vendored
@@ -2759,6 +2759,24 @@ declare module "mongoose" {
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
|
||||
|
||||
/**
|
||||
* Issue a mongodb findOneAndDelete command by a document's _id field.
|
||||
* findByIdAndDelete(id, ...) is equivalent to findByIdAndDelete({ _id: id }, ...).
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T>;
|
||||
findByIdAndDelete(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
findByIdAndDelete(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...)
|
||||
|
||||
Reference in New Issue
Block a user