Last active
March 31, 2020 01:30
-
-
Save dalthonmh/ff7183ba7dec58e8c8a4360599766694 to your computer and use it in GitHub Desktop.
Mongo Seeding CLI | examples/import-data-json/getOrders.js
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
const Order = require("../models/order"); | |
const Plate = require("../models/plate"); | |
function getOrders(req, res) { | |
Order.find({}, (err, order) => { | |
if (err) { | |
throw err; | |
} else { | |
Plate.populate(order, { path: "order_detail" }, (err, order) => { | |
res.status(200).send(order); | |
}); | |
} | |
}); | |
} | |
module.exports = { | |
getOrders, | |
... others | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment