switched everything over to Mongoose

This commit is contained in:
Luke Berndt
2023-04-10 22:51:57 -04:00
parent 0062c404bf
commit 6fbd97bbb6
9 changed files with 211 additions and 259 deletions

View File

@@ -1,9 +1,7 @@
var db = require('../db');
const Talkgroup = require("../models/talkgroup");
exports.get_talkgroups = async function (req, res) {
const tg_coll = db.get().collection('talkgroups');
const cursor = tg_coll.find({ 'shortName': req.params.shortName.toLowerCase() })
const tg_results = await cursor.toArray();
const tg_results = await Talkgroup.find({ 'shortName': req.params.shortName.toLowerCase()})
var talkgroups = {};
for (var tg in tg_results) {
talkgroups[tg_results[tg].num] = tg_results[tg];