Mongoose two level population using KeystoneJs [duplicate]
In mongoose you can do this way:
regionModel.find().populate("countries").exec(function(err, regions){ if(err){ throw err; } // Regions with populate countries cityModel.populate(regions, { path: 'countries.cities', select: '_id name' },function(err, regions) { //Regions with Countries and Populated Cities });})
Actually i dont familiar with keystone syntax, but i try to convert it to keystone syntax. Hope it works, if not please try to convert above code equivalent to keystonejs
keystone.list('Region').model.find() .populate('countries') .exec(function(err, regions){ if(err){ throw err; } keystone.list('City').model.find() .populate('cities') .exec(function(err, regions){ console.log(regions) }); });