meteor中仅客户端集合上的Crud操作
我有一个客户专用的收藏meteor中仅客户端集合上的Crud操作,meteor,minimongo,Meteor,Minimongo,我有一个客户专用的收藏 feedComments=new Mongo.Collection('feeds'); 使用meteor composite,我在这个集合中发布了一些记录 当我尝试更新客户端中的集合时 feedComments.update({_id:result._id},{$set:{name:"xxx"}}); 它不允许我这么做,这是一个错误 method not found 为什么我不能插入或更新仅客户端集合,为什么客户端集合没有这些方法 我不知道这可以做到,但我也试过了
feedComments=new Mongo.Collection('feeds');
使用meteor composite,我在这个集合中发布了一些记录
当我尝试更新客户端中的集合时
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;
}
});
要在仅客户端集合上执行crud操作,请用户
\u集合
试一试
我猜您在变量
提要中定义了集合,并且您正在使用提要注释@ajduke,这是打字错误。在您的声明中,您是否尝试定义仅客户端集合?是的,这是我的问题好的,尝试像这样定义仅客户端集合-feedComments=new Mongo.collection(null)代码>。观察null
passed
feedComments._collection.update({_id:result._id},{$set:{name:"xxx"}});