i try to figure out what I'am doing wrong that moongose is not updating my document. Just for testing the id's are hardcoded.
node.js
var id1 = "592fd471fedd311d5c76a024";
var id2 = "592fd4ad608e001d79938ba8";
Workshop.update(
{ _id: id1, 'themen._id' : id2},
{ '$set':
{ 'themen.$.risikolandschaft': ["John", "Doe"], }
},
function(err,body) {
if (err) { console.log(err) }
else { console.log(body);}
}
);
here my data copied from MongoDB Compass
_id:592fd471fedd311d5c76a024
bezeichnung:Workshop 1.5.2017 / 10:46
themen:Array
0:Object
thema:Object
risikolandschaft:Array
date:2017-06-01T08:47:41.944Z
_id:592fd4ad608e001d79938ba8
stammdaten:Array
the log from body
{ n: 0, nModified: 0, ok: 1 }
"mongoose": "^4.8.6"
via miholzi
No comments:
Post a Comment