@@ -994,58 +994,4 @@ describe('document.populate', function() {
994
994
assert . deepStrictEqual ( codeUser . extras [ 0 ] . config . paymentConfiguration . paymentMethods [ 0 ] . _id , code . _id ) ;
995
995
assert . strictEqual ( codeUser . extras [ 0 ] . config . paymentConfiguration . paymentMethods [ 0 ] . code , 'test code' ) ;
996
996
} ) ;
997
-
998
- it ( 'works when populating a nested document not inside an array parent (gh-14435)' , async function ( ) {
999
- const CodeSchema = new Schema ( {
1000
- code : String
1001
- } ) ;
1002
-
1003
- const UserSchema = new Schema ( {
1004
- username : String ,
1005
- extras : new Schema ( {
1006
- config : new Schema ( {
1007
- paymentConfiguration : {
1008
- paymentMethods : [
1009
- {
1010
- type : Schema . Types . ObjectId ,
1011
- ref : 'Code'
1012
- }
1013
- ]
1014
- }
1015
- } )
1016
- } )
1017
- } ) ;
1018
-
1019
- const Code = db . model ( 'Code' , CodeSchema ) ;
1020
- const CodeUser = db . model ( 'CodeUser' , UserSchema ) ;
1021
-
1022
- const code = await Code . create ( {
1023
- code : 'test code'
1024
- } ) ;
1025
-
1026
- await CodeUser . create ( {
1027
- username : 'TestUser' ,
1028
- extras : {
1029
- config : {
1030
- paymentConfiguration : {
1031
- paymentMethods : [ code . _id ]
1032
- }
1033
- }
1034
- }
1035
- } ) ;
1036
-
1037
- const codeUser = await CodeUser . findOne ( { username : 'TestUser' } ) . populate (
1038
- 'extras.config.paymentConfiguration.paymentMethods'
1039
- ) ;
1040
-
1041
- assert . ok ( codeUser . username ) ;
1042
- assert . strictEqual ( codeUser . username , 'TestUser' ) ;
1043
- assert . ok ( codeUser . extras ) ;
1044
- assert . ok ( codeUser . extras . config ) ;
1045
- assert . ok ( codeUser . extras . config . paymentConfiguration ) ;
1046
- assert . ok ( codeUser . extras . config . paymentConfiguration . paymentMethods ) ;
1047
- assert . strictEqual ( codeUser . extras . config . paymentConfiguration . paymentMethods . length , 1 ) ;
1048
- assert . deepStrictEqual ( codeUser . extras . config . paymentConfiguration . paymentMethods [ 0 ] . _id , code . _id ) ;
1049
- assert . strictEqual ( codeUser . extras . config . paymentConfiguration . paymentMethods [ 0 ] . code , 'test code' ) ;
1050
- } ) ;
1051
997
} ) ;
0 commit comments