@@ -59,7 +59,7 @@ describe('create collection', () => {
5959 { parentId : car . _id , date : '2020-01-01' , comment : 'my comment 2' } ,
6060 ] ) ;
6161
62- const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) ;
62+ const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) . lean ( ) ;
6363
6464 expect ( car ) . toEqual (
6565 expect . objectContaining ( {
@@ -75,7 +75,7 @@ describe('create collection', () => {
7575 expect . objectContaining ( { _id : `${ car . _id } .engine.comments.1` } ) ,
7676 ] ) ;
7777
78- expect ( doc ) . toEqual (
78+ expect ( doc as any ) . toEqual (
7979 expect . objectContaining ( {
8080 name : 'my fiesta' ,
8181 wheelSize : 12 ,
@@ -125,9 +125,9 @@ describe('create collection', () => {
125125 { capacity : 12 , category : 'EXPLOSION' } ,
126126 ) ;
127127
128- const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) ;
128+ const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) . lean ( ) ;
129129
130- expect ( doc ) . toEqual (
130+ expect ( doc as any ) . toEqual (
131131 expect . objectContaining ( {
132132 name : 'my fiesta' ,
133133 wheelSize : 12 ,
@@ -165,10 +165,10 @@ describe('create collection', () => {
165165 . getCollection ( 'cars_engine_comments' )
166166 . create ( caller , [ { parentId : car . _id , ...flatRecord } ] ) ;
167167
168- const carSeenFromDb = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) ;
168+ const carSeenFromDb = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) . lean ( ) ;
169169
170170 expect ( carCommentFromApp ) . toMatchObject ( flatRecord ) ;
171- expect ( carSeenFromDb . engine . comments [ 0 ] ) . toEqual (
171+ expect ( ( carSeenFromDb as any ) . engine . comments [ 0 ] ) . toEqual (
172172 expect . objectContaining ( {
173173 date : expect . any ( Date ) ,
174174 comment : 'hi!' ,
@@ -192,7 +192,7 @@ describe('create collection', () => {
192192 . getCollection ( 'cars_engine' )
193193 . create ( caller , [ { parentId : car . _id , horsePower : '12' } ] ) ;
194194
195- const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) ;
195+ const doc = await connection . model ( 'cars' ) . findOne ( { _id : car . _id } ) . lean ( ) ;
196196
197197 expect ( result ) . toEqual (
198198 expect . arrayContaining ( [
@@ -202,7 +202,7 @@ describe('create collection', () => {
202202 ] ) ,
203203 ) ;
204204
205- expect ( doc ) . toEqual (
205+ expect ( doc as any ) . toEqual (
206206 expect . objectContaining ( {
207207 name : 'my fiesta' ,
208208 wheelSize : 12 ,
0 commit comments