@@ -2498,12 +2498,12 @@ Query.prototype._findOne = async function _findOne() {
2498
2498
// don't pass in the conditions because we already merged them in
2499
2499
const doc = await this . mongooseCollection . findOne ( this . _conditions , options ) ;
2500
2500
return new Promise ( ( resolve , reject ) => {
2501
- this . _completeOne ( doc , null , _wrapThunkCallback ( this , ( err , res ) => {
2501
+ this . _completeOne ( doc , null , ( err , res ) => {
2502
2502
if ( err ) {
2503
2503
return reject ( err ) ;
2504
2504
}
2505
2505
resolve ( res ) ;
2506
- } ) ) ;
2506
+ } ) ;
2507
2507
} ) ;
2508
2508
} ;
2509
2509
@@ -3303,12 +3303,12 @@ Query.prototype._findOneAndUpdate = async function _findOneAndUpdate() {
3303
3303
const doc = ! options . includeResultMetadata ? res : res . value ;
3304
3304
3305
3305
return new Promise ( ( resolve , reject ) => {
3306
- this . _completeOne ( doc , res , _wrapThunkCallback ( this , ( err , res ) => {
3306
+ this . _completeOne ( doc , res , ( err , res ) => {
3307
3307
if ( err ) {
3308
3308
return reject ( err ) ;
3309
3309
}
3310
3310
resolve ( res ) ;
3311
- } ) ) ;
3311
+ } ) ;
3312
3312
} ) ;
3313
3313
} ;
3314
3314
@@ -3399,12 +3399,12 @@ Query.prototype._findOneAndDelete = async function _findOneAndDelete() {
3399
3399
const doc = ! includeResultMetadata ? res : res . value ;
3400
3400
3401
3401
return new Promise ( ( resolve , reject ) => {
3402
- this . _completeOne ( doc , res , _wrapThunkCallback ( this , ( err , res ) => {
3402
+ this . _completeOne ( doc , res , ( err , res ) => {
3403
3403
if ( err ) {
3404
3404
return reject ( err ) ;
3405
3405
}
3406
3406
resolve ( res ) ;
3407
- } ) ) ;
3407
+ } ) ;
3408
3408
} ) ;
3409
3409
} ;
3410
3410
@@ -3553,12 +3553,12 @@ Query.prototype._findOneAndReplace = async function _findOneAndReplace() {
3553
3553
3554
3554
const doc = ! includeResultMetadata ? res : res . value ;
3555
3555
return new Promise ( ( resolve , reject ) => {
3556
- this . _completeOne ( doc , res , _wrapThunkCallback ( this , ( err , res ) => {
3556
+ this . _completeOne ( doc , res , ( err , res ) => {
3557
3557
if ( err ) {
3558
3558
return reject ( err ) ;
3559
3559
}
3560
3560
resolve ( res ) ;
3561
- } ) ) ;
3561
+ } ) ;
3562
3562
} ) ;
3563
3563
} ;
3564
3564
@@ -4382,28 +4382,6 @@ function _executePreHooks(query, op) {
4382
4382
} ) ;
4383
4383
}
4384
4384
4385
- /*!
4386
- * ignore
4387
- */
4388
-
4389
- function _wrapThunkCallback ( query , cb ) {
4390
- return function ( error , res ) {
4391
- if ( error != null ) {
4392
- return cb ( error ) ;
4393
- }
4394
-
4395
- for ( const fn of query . _transforms ) {
4396
- try {
4397
- res = fn ( res ) ;
4398
- } catch ( error ) {
4399
- return cb ( error ) ;
4400
- }
4401
- }
4402
-
4403
- return cb ( null , res ) ;
4404
- } ;
4405
- }
4406
-
4407
4385
/**
4408
4386
* Executes the query returning a `Promise` which will be
4409
4387
* resolved with either the doc(s) or rejected with the error.
0 commit comments