Created
November 24, 2016 05:48
-
-
Save ZZR-china/4a83bff0eeaa895bf38564bf7709817b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getOrderById = (_id)=> { | |
return new Promise((resolve, reject)=>{ | |
order_item_mongo.aggregate([{ | |
$match: {order_id: id} | |
}, { | |
$group : { | |
// _id : "$menu_id", | |
_id: { menu_id:"$menu_id", menu_name:"$menu_name"}, | |
products: { $push: { product_name: "$product_name"} } | |
} | |
}], (err, docs) => { | |
if (docs) { | |
resolve(docs) | |
}else{ | |
reject('get group orderitem fail') | |
} | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment