1// Find the adventure with the given `id`, or `null` if not found
2await Adventure.findById(id).exec();
3
4// using callback
5Adventure.findById(id, function (err, adventure) {});
6
7// select only the adventures name and length
8await Adventure.findById(id, 'name length').exec();
1exports.generateList = function (req, res) {
2 subcategories
3 .find({})//grabs all subcategoris
4 .where('categoryId').ne([])//filter out the ones that don't have a category
5 .populate('categoryId')
6 .where('active').equals(true)
7 .where('display').equals(true)
8 .where('categoryId.active').equals(true)
9 .where('display').in('categoryId').equals(true)
10 .exec(function (err, data) {
11 if (err) {
12 console.log(err);
13 console.log('error returned');
14 res.send(500, { error: 'Failed insert' });
15 }
16
17 if (!data) {
18 res.send(403, { error: 'Authentication Failed' });
19 }
20
21 res.send(200, data);
22 console.log('success generate List');
23 });
24 };