Tuesday, 2 May 2017

Mongodb (nodejsdriver) updateOne query error: MongoError: Either an update or remove=true must be specified

I'm currently using mongodb nodejs native driver (MongoDB server version:3.4.1) and I'm using this query:

   collection.updateOne(
     { _id : mongodb.ObjectId(data.myId) },
     { $set: { key : data.key } }
   );

and I'm receiving this error:

(node:12965) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): MongoError: Either an update or remove=true must be specified

Where is the problem?



via Helio

No comments:

Post a Comment