skip to Main Content

Mongodb – When i parse by req.query boolean and number to json it becomes string. Mongo .find() finds nothing

Back end (nodejs) async getAllEvents(req, res, database, collection) { try { const { filter, sort } = req.query; const events = await mongo .getClient() .db(database) .collection(collection) .find(filter) .sort(sort) .toArray(); res.json(events); res.end(); } catch (error) { return res.status(400).json({ message: "err_get_events" });…

VIEW QUESTION
Back To Top
Search