mongoose 怎么多个model查询
 发布于 8 年前  作者 BusyHe  4166 次预览  最后一次回复是 8 年前  来自 问答 

不如有个A model: aModel = { user_id: String, file_name: String, page_id: Number } B model: fileSchema = new Schema({ page_id: Number, key: String, doc: String, title: String, sym: String });

bModel = { user_id: String, file_name: String, origin_file: String, new_file: [fileSchema] }

已知user_id,file_name,page_id, model find是异步的,怎么同时查找这两个model,得到两个结果后再进行下一步

3 回复
xiaqiubo

mongoose不是默认支持promise么?使用promise.all处理两个后拿到数据再处理后边的

babto

promise ==> async / await

JarvisQJ

function(){ function(){

}

}