File tree 2 files changed +5
-5
lines changed 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1022,7 +1022,7 @@ Aggregate.prototype.exec = async function exec() {
1022
1022
applyGlobalMaxTimeMS ( this . options , model . db . options , model . base . options ) ;
1023
1023
applyGlobalDiskUse ( this . options , model . db . options , model . base . options ) ;
1024
1024
1025
- const asyncLocalStorage = this . model ?. db ?. base . transactionAsyncLocalStorage ?. getStore ( ) ;
1025
+ const asyncLocalStorage = this . model ( ) ?. db ?. base . transactionAsyncLocalStorage ?. getStore ( ) ;
1026
1026
if ( ! this . options . hasOwnProperty ( 'session' ) && asyncLocalStorage ?. session != null ) {
1027
1027
this . options . session = asyncLocalStorage . session ;
1028
1028
}
Original file line number Diff line number Diff line change @@ -370,7 +370,7 @@ describe('transactions', function() {
370
370
await Test . createCollection ( ) ;
371
371
await Test . deleteMany ( { } ) ;
372
372
373
- const doc = new Test ( { name : 'test ' } ) ;
373
+ const doc = new Test ( { name : 'test_transactionAsyncLocalStorage ' } ) ;
374
374
await assert . rejects (
375
375
( ) => m . connection . transaction ( async ( ) => {
376
376
await doc . save ( ) ;
@@ -383,10 +383,10 @@ describe('transactions', function() {
383
383
docs = await Test . find ( { _id : doc . _id } ) ;
384
384
assert . equal ( docs . length , 1 ) ;
385
385
386
- docs = await Promise . all ( [ async ( ) => {
386
+ docs = await async function test ( ) {
387
387
return await Test . findOne ( { _id : doc . _id } ) ;
388
- } ] ) . then ( res => res [ 0 ] ) ;
389
- assert . equal ( docs . length , 1 ) ;
388
+ } ( ) ;
389
+ assert . equal ( doc . name , 'test_transactionAsyncLocalStorage' ) ;
390
390
391
391
throw new Error ( 'Oops!' ) ;
392
392
} ) ,
You can’t perform that action at this time.
0 commit comments