@@ -4006,22 +4006,28 @@ describe('Query', function() {
40064006 } ) ;
40074007 const Test = db . model ( 'gh10423' , testSchema ) ;
40084008 await Test . create ( { name : 'foo' , foo : [ { sub : 'Test' } , { sub : 'Testerson' } ] , otherName : { nickName : 'Bar' } } ) ;
4009- const result = await Test . find ( ) . lean ( { transform : ( doc ) => {
4010- delete doc . _id ;
4011- return doc ;
4012- } } ) ;
4013- assert ( result [ 0 ] . _id ) ;
4014- assert . equal ( result [ 0 ] . otherName . _id , undefined ) ;
4015- assert . equal ( result [ 0 ] . foo [ 0 ] . _id , undefined ) ;
4016- assert . equal ( result [ 0 ] . foo [ 1 ] . _id , undefined ) ;
4017- const single = await Test . findOne ( ) . lean ( { transform : ( doc ) => {
4018- delete doc . _id ;
4019- return doc ;
4020- } } ) ;
4021- assert ( single . _id ) ;
4022- assert . equal ( single . otherName . _id , undefined ) ;
4023- assert . equal ( single . foo [ 0 ] . _id , undefined ) ;
4024- assert . equal ( single . foo [ 0 ] . _id , undefined ) ;
4009+
4010+ const result = await Test . find ( ) . lean ( {
4011+ transform : ( doc ) => {
4012+ delete doc . _id ;
4013+ return doc ;
4014+ }
4015+ } ) ;
4016+ assert . strictEqual ( result [ 0 ] . _id , undefined ) ;
4017+ assert . strictEqual ( result [ 0 ] . otherName . _id , undefined ) ;
4018+ assert . strictEqual ( result [ 0 ] . foo [ 0 ] . _id , undefined ) ;
4019+ assert . strictEqual ( result [ 0 ] . foo [ 1 ] . _id , undefined ) ;
4020+
4021+ const single = await Test . findOne ( ) . lean ( {
4022+ transform : ( doc ) => {
4023+ delete doc . _id ;
4024+ return doc ;
4025+ }
4026+ } ) ;
4027+ assert . strictEqual ( single . _id , undefined ) ;
4028+ assert . strictEqual ( single . otherName . _id , undefined ) ;
4029+ assert . strictEqual ( single . foo [ 0 ] . _id , undefined ) ;
4030+ assert . strictEqual ( single . foo [ 0 ] . _id , undefined ) ;
40254031 } ) ;
40264032
40274033 it ( 'skips applying default projections over slice projections (gh-11940)' , async function ( ) {
0 commit comments