Sunday, 15 July 2012

With Meteor, how can I update a document based on MongoDB's ObjectID()? -



With Meteor, how can I update a document based on MongoDB's ObjectID()? -

i created kid array of objects in document. each of these array objects have:

children: [ { _id: objectid("lkajsdflkajdsf"), title: "something" }, ... ]

i'm getting objectid undefined error when trying update document:

category.update( { "_id": "c2rcjivw96htjshrq", "children._id": objectid("1c46382a25d3888165dd338a") }, { "$set": { "children.$.title": "hello world" }} );

as can see i'm attempting update specific array object it's associated _id. not work. reading thread: meteor collection update traditional id

but it's little outdated, , i'm getting errors when trying utilize it.

is there solid method handling things in fashion? can in mongo shell no problem, not through meteor methods.

thanks!

meteor

No comments:

Post a Comment