meteor - this.removed(collection, id) makes somewhere exception thrown -


i'm trying inform subscribers when document removed collection. use this.removed(collection, id) when removed function of observechanges called:

meteor.publish('tasks_listspub', function(surl){     ...     var self = this;     octaskslists.find().observechanges({         added: function (sid, ofields) {             console.log('added:'+sid);             self.added('tasks_lists', sid, ofields);         },         removed: function (sid) {             console.log('removed:'+sid);             self.removed('tasks_lists', sid); //throws exception works in browser         },         changed: function(sid, ofields){             console.log('changed:'+sid);             self.changed('tasks_lists', sid, ofields);         }     });     var cvisibletaskslists = octaskslists.find({_id: {$in: ows.tasks_lists}});     return cvisibletaskslists; }); 

the problem server throws exception:

removed:k8bbys7wrh4ttqrbg exception in queued task: error: removed nonexistent document k8bbys7wrh4ttqrbg @ _.extend.removed (app/packages/livedata/livedata_server.js:181:17) 

and other browsers not remove deleted document. solution? thx

you appear publishing 2 conflicting datasets within 1 publish function.

the self.added, self.removed, , self.changed functions inside observechanges trying keep client updated everything in octaskslists.

return cvisibletaskslists; trying publish subset of octaskslists match query.

these conflicting publish instructions lead client not having documents removed octaskslists - error message results.

whether want whole dataset or subset either can done returning database cursor in last 2 lines. removing observechanges function along .added, .removed, , .changed functions fix error.


Comments