0

我有一个仅限客户的收藏

feedComments=new Mongo.Collection('feeds');

使用流星复合我向这个集合发布了一些记录,

当我尝试更新客户端中的集合时

feedComments.update({_id:result._id},{$set:{name:"xxx"}});

它不允许我抛出错误

method not found

为什么我不能插入或更新仅限客户端的集合,为什么客户端集合没有这些方法?

不知道这可以做到,但我也试过这个

feedComments.allow({
    insert: function (userId, doc) {
        return true;
    },
    update: function (userId, doc, fields, modifier) {
        return false;
    },
    remove: function (userId, doc) {
        return false;
    }
 });
4

1 回答 1

2

to perform crud operations on client only collections user _collection

try

feedComments._collection.update({_id:result._id},{$set:{name:"xxx"}});
于 2015-01-28T12:00:35.813 回答