skip to Main Content

Mongodb – Model.findOne() is returning null

Model.findOne() is returning null even if the valid collection is present in the respective Model app.post("/fleetManagement", (req, res) => { const requestedDriverID = req.body.driverId; console.log(requestedDriverID); Driver.findOne({ _id: requestedDriverID }, function(err, requestedDriverResult) { console.log(requestedDriverResult); res.render("fleetManagement", { reqDriver: requestedDriverResult }); }); })…

VIEW QUESTION

Mongodb aggregation response

I have a Property controller : //Get Properties By Type const getPropertiesByType = async (req: Request, res: Response) => { const { cities, type } = req.query const citiesArr = typeof cities === 'string' ? cities.split(',') : [] try {…

VIEW QUESTION
Back To Top
Search