マングースでは、次のように行うことができます:
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
});
})
実際、私はキーストーン構文に精通していませんが、キーストーン構文に変換しようとしています。うまくいくことを願っていますが、そうでない場合は、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)
});
});