@@ -567,43 +567,38 @@ describe('transactions', function() {
567567
568568 it ( 'transaction() avoids duplicating atomic operations (gh-14848)' , async function ( ) {
569569 db . deleteModel ( / T e s t / ) ;
570- // Define some schemas...
571570 const subItemSchema = new mongoose . Schema (
572- {
573- name : { type : String , required : true } ,
571+ {
572+ name : { type : String , required : true }
574573 } ,
575574 { _id : false }
576575 ) ;
577-
578576 const itemSchema = new mongoose . Schema (
579577 {
580578 name : { type : String , required : true } ,
581- subItems : { type : [ subItemSchema ] , required : true } ,
579+ subItems : { type : [ subItemSchema ] , required : true }
582580 } ,
583581 { _id : false }
584582 ) ;
585-
586583 const schema = new mongoose . Schema ( {
587- items : { type : [ itemSchema ] , required : true } ,
584+ items : { type : [ itemSchema ] , required : true }
588585 } ) ;
589-
590- // ...and a model
591- const Test = db . model ( "Test" , schema ) ;
586+ const Test = db . model ( 'Test' , schema ) ;
592587
593588
594589 await Test . createCollection ( ) ;
595590 await Test . deleteMany ( { } ) ;
596591
597592 const { _id } = await Test . create ( {
598593 items : [
599- { name : " test1" , subItems : [ { name : "x1" } ] } ,
600- { name : " test2" , subItems : [ { name : "x2" } ] } ,
601- ] ,
594+ { name : ' test1' , subItems : [ { name : 'x1' } ] } ,
595+ { name : ' test2' , subItems : [ { name : 'x2' } ] }
596+ ]
602597 } ) ;
603-
598+
604599 let doc = await Test . findById ( _id ) ;
605-
606- doc . items . push ( { name : " test3" , subItems : [ { name : "x3" } ] } ) ;
600+
601+ doc . items . push ( { name : ' test3' , subItems : [ { name : 'x3' } ] } ) ;
607602
608603 let i = 0 ;
609604 await db . transaction ( async ( session ) => {
@@ -616,7 +611,7 @@ describe('transactions', function() {
616611 } ) ;
617612
618613 assert . equal ( i , 3 ) ;
619-
614+
620615 doc = await Test . findById ( _id ) ;
621616 assert . equal ( doc . items . length , 3 ) ;
622617 } ) ;
0 commit comments