最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I remove an item from a lists collection in Meteor? - Stack Overflow

programmeradmin5浏览0评论

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!

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!

Share Improve this question edited Apr 2, 2013 at 12:15 Joseph at SwiftOtter 4,3215 gold badges38 silver badges56 bronze badges asked Apr 2, 2013 at 11:58 Valentin G.Valentin G. 1752 gold badges2 silver badges8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14

lists.remove('T88C6tx4G9YJpLzn5') will remove the document with the _id: T88C6tx4G9YJpLzn5.

http://docs.meteor./#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./#meteor_methods

发布评论

评论列表(0)

  1. 暂无评论