In my collection, there is only one document.
> db.c20160712.find()
{ \"_id\" : ObjectId(\"57ab909791c3b3a393e9e277\"), \"Dimension_id\" : 2, \"Attribute\
You should use this code because I was also facing the same problem and then I used this code:
updateOne(
{ _id: new ObjectID(req.params.id) },
{ $set: { title: req.body.bookName, author: req.body.authorName } },
{ upsert: true }
)
and you should also define ObjectID
otherwise the problem will occur again.
const ObjectID = require('mongodb').ObjectID;