MongoDB - IssueTracker - Trouble returning documents with db.collection.find()

Hi. I’m working on the issue tracker project and having trouble getting my db.collection methods to work. For instance, right now I’m trying to execute a find operation.

db.collection('issues').find({_id:ObjectId(req.body._id)},(err,data)=>{
        if (err){console.log(err);res.send('could not update '+data._id)}
        res.json(data);

I’m expecting the operation to return a document from my collection. The _id I’m passing definitely matches one of them. Instead, when I console log the returned data in my callback, I’m getting an object with properties named pool, server, disconnectHandler, bson, ns …and a bunch more stuff I’m not interested in. I have MongoClient and ObjectID required.

Does this type of response to a find() request look familiar to anyone?

Hello @PeterHSteele try find().toArray((err, data) => {…}) and return the data var

Hope it helps

thanks @galanis-a! this is a good reminder if i ever use the node mongodb driver again. eventually i decided to use mongoose for everything because its way easier.