Skip to content

Instantly share code, notes, and snippets.

@dalthonmh
Last active March 31, 2020 01:30
Show Gist options
  • Save dalthonmh/ff7183ba7dec58e8c8a4360599766694 to your computer and use it in GitHub Desktop.
Save dalthonmh/ff7183ba7dec58e8c8a4360599766694 to your computer and use it in GitHub Desktop.
Mongo Seeding CLI | examples/import-data-json/getOrders.js
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