Created
October 13, 2018 14:32
-
-
Save klogic/8f885427a37f36139b561d8765cac792 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let promises = [] | |
promises.push( | |
Orders | |
.find() | |
.sort('-create') | |
.lean() | |
.then((result) => { | |
return result; | |
}) | |
); | |
Promise | |
.all(promises) | |
.then((data) => { | |
data.forEach(item => { | |
// calculate data1 | |
}) | |
data.forEach(item => { | |
// calculate data2 | |
}) | |
data.forEach(item => { | |
// calculate data3 | |
}) | |
res.status(200).json({ | |
reponse | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment