I created a child array of objects in a document. Each of these array objects have:
children: [
{
_id: ObjectID("lkajsdflkajdsf"),
title: "Something"
}, ...
]
I'm getting ObjectId undefined error when trying to update a document:
Category.update(
{ "_id": "C2Rcjivw96htJSHRq", "children._id": ObjectId("1c46382a25d3888165dd338a") },
{ "$set": { "children.$.title": "Hello World" }}
);
As you can see I'm attempting to update a specific array object by it's associated _id. This does not work. I was reading this thread: Meteor collection update with traditional id
But it's a little outdated, and I'm also getting errors when trying to use it.
Is there a solid method for handling things in this fashion? I can do this in Mongo shell with no problem, but not through Meteor methods.
Thanks!