Search code examples
meteorminimongo

Crud operations on client only collection in meteor


I have a client only collection

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

Using meteor composite I'm publishing few records to this collection,

when I try to update the collection in client

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

It is not allowing me to it is throwing error

method not found

why can't I insert or update the client only collection,why do client collections don't have those methods?

don't know this can be done,but I tried with this too

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

Solution

  • to perform crud operations on client only collections user _collection

    try

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