I am trying to create a "show" page to present more Infrmation about an Item from MongoDB. I would like to pass a Javascript Object with a specific id into my Vue Instance. However it renders an invalid Object:
_doc: {
name: 'Dr. Florent Ratatouille',
_id: ObjectID { _bsontype: 'ObjectID', id: '^ÚlV4QºÄ;ù' }
}
The client then throws the error in the last line:
Uncaught SyntaxError: Unexpected token '{'.
The _id property is not declared by me but by mongodb. The backend looks like this:
app.get("/docs/:id", function(req, res){
doc.findById(req.params.id).populate("comments").exec(function(err, foundDoc){
if(err){
console.log(err);
} else {
console.log(foundDoc)
res.render("docs/show2", {doc: foundDoc});
}
});
});
Have you any Ideas whats going on? Am I missing something obvious? Any help is greatly appreciated!