💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## **一 ~ 十 请看第六节** ## **十一、 Mongoose aggregate 多表关联查询** ``` var mongoose=require('./db.js'); var OrderSchema=mongoose.Schema({ order_id:String, uid:Number, trade_no:String, all_price:Number, all_num:Number }) var OrderModel=mongoose.model('Order',OrderSchema,'order'); OrderModel.aggregate( [{ $lookup: { from:'order_item', localField:"order_id", foreignField:"order_id", as:"item" } }], function(err,docs){ console.log(docs) } ); ```