I have the following query which is successful in the MongoDB CLI client but unsuccessful with its equivalent in Mongoose:// MongoDB client successfully updates collection db.col.updateOne({_id: "5f687da23a4dc9071baefd6d"}, {$set: { 'licence.count' : 5 }}) // Mongoose query which fails Organisation.updateOne({_id: "5f687da23a4dc9071baefd6d"}, {$set: {'licence.count' : 5}}) The table is simply an _id with a field called licence which contains a nested document containing a count. Is there a different syntax for accessing nested fields in MongoDB as I am able to set fields at top level such as licence itself?
Submitted September 24, 2020 at 02:53PM by azt4er
No comments:
Post a Comment