How do I remove an item from a lists collection in Meteor?
lists.remove('T88C6tx4G9YJpLzn5') will remove the document with the _id: T88C6tx4G9YJpLzn5.
http://docs.meteor.com/#remove
If you want to remove more than one document you can define a method which runs on the server and call from the client.
http://docs.meteor.com/#meteor_methods
Valentin G.
Working in Web Development, I am interested in new technologies and how to apply them to create things that matter and impact people's experience in a positive way.
Updated on June 17, 2022Comments
-
Valentin G. almost 2 years
I'm following a book example about Meteor and I'm trying to remove an item, like this:
lists.remove({Category:"Fraggles"})
However, this doesn't work anymore in the last version of Meteor and I get the following console error: 403 reason: "Not permitted. Untrusted code may only remove documents by ID."
I found the id like this:
lists.findOne({Category:"Fraggles"}) Object {_id: "T88C6tx4G9YJpLzn5", Category: "Fraggles"}
But I do not know how to use the correct syntax to actually remove it. Any help would be appreciated.
Thank you!