mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
mongoose: remove null from result type when doc must exist
This commit is contained in:
9
types/mongoose/index.d.ts
vendored
9
types/mongoose/index.d.ts
vendored
@@ -1545,6 +1545,9 @@ declare module "mongoose" {
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any, options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
|
||||
@@ -2520,6 +2523,9 @@ declare module "mongoose" {
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
@@ -2565,6 +2571,9 @@ declare module "mongoose" {
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
|
||||
@@ -758,6 +758,7 @@ query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, {
|
||||
}, cb);
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, cb);
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'});
|
||||
query.findOneAndUpdate({}, {}, { upsert: true, new: true });
|
||||
query.findOneAndUpdate({name: 'bb'}, cb);
|
||||
query.findOneAndUpdate({name: 'bb'});
|
||||
query.findOneAndUpdate(cb);
|
||||
@@ -1387,6 +1388,7 @@ MongoModel.findByIdAndRemove(999);
|
||||
MongoModel.findByIdAndRemove();
|
||||
MongoModel.findByIdAndUpdate(999, {}, {}, cb);
|
||||
MongoModel.findByIdAndUpdate(999, {}, {});
|
||||
MongoModel.findByIdAndUpdate(999, {}, { upsert: true, new: true });
|
||||
MongoModel.findByIdAndUpdate(999, {}, cb);
|
||||
MongoModel.findByIdAndUpdate(999, {});
|
||||
MongoModel.findByIdAndUpdate();
|
||||
@@ -1415,6 +1417,7 @@ MongoModel.findOneAndRemove({});
|
||||
MongoModel.findOneAndRemove();
|
||||
MongoModel.findOneAndUpdate({}, {}, {}, cb);
|
||||
MongoModel.findOneAndUpdate({}, {}, {});
|
||||
MongoModel.findOneAndUpdate({}, {}, { upsert: true, new: true });
|
||||
MongoModel.findOneAndUpdate({}, {}, cb);
|
||||
MongoModel.findOneAndUpdate({}, {});
|
||||
MongoModel.findOneAndUpdate();
|
||||
|
||||
9
types/mongoose/v4/index.d.ts
vendored
9
types/mongoose/v4/index.d.ts
vendored
@@ -1602,6 +1602,9 @@ declare module "mongoose" {
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType, DocType>;
|
||||
findOneAndUpdate(query: any | Query<any>, update: any, options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
|
||||
@@ -2528,6 +2531,9 @@ declare module "mongoose" {
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T>;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
@@ -2573,6 +2579,9 @@ declare module "mongoose" {
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T>;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
|
||||
@@ -743,6 +743,8 @@ query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, {
|
||||
}, cb);
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, cb);
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'});
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, { });
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, { upsert: true, new: true });
|
||||
query.findOneAndUpdate({name: 'bb'}, cb);
|
||||
query.findOneAndUpdate({name: 'bb'});
|
||||
query.findOneAndUpdate(cb);
|
||||
@@ -1371,6 +1373,7 @@ MongoModel.findByIdAndRemove(999);
|
||||
MongoModel.findByIdAndRemove();
|
||||
MongoModel.findByIdAndUpdate(999, {}, {}, cb);
|
||||
MongoModel.findByIdAndUpdate(999, {}, {});
|
||||
MongoModel.findByIdAndUpdate(999, {}, { new: true, upsert: true }, cb);
|
||||
MongoModel.findByIdAndUpdate(999, {}, cb);
|
||||
MongoModel.findByIdAndUpdate(999, {});
|
||||
MongoModel.findByIdAndUpdate();
|
||||
@@ -1399,6 +1402,7 @@ MongoModel.findOneAndRemove({});
|
||||
MongoModel.findOneAndRemove();
|
||||
MongoModel.findOneAndUpdate({}, {}, {}, cb);
|
||||
MongoModel.findOneAndUpdate({}, {}, {});
|
||||
MongoModel.findOneAndUpdate({}, {}, { upsert: true, new: true });
|
||||
MongoModel.findOneAndUpdate({}, {}, cb);
|
||||
MongoModel.findOneAndUpdate({}, {});
|
||||
MongoModel.findOneAndUpdate();
|
||||
|
||||
Reference in New Issue
Block a user