Is there any possibility of calling a server method from within a observe
callback in Meteor?
I put together an example that reproduces the issue, that
This might be a known issue, i'm not sure since I've not tried it myself, but it looks like there might be a workaround (see https://github.com/meteor/meteor/issues/907)
Add your Meteor.call
into an instantaneous setTimeout callback:
added: function(doc) {
console.log("added "+doc.text);
setTimeout(function() {
Meteor.call('aMethod',doc.text,function(e,r){
if(e){
console.log("error from server: "+e);
}else{
console.log("response from server: "+r);
}
});
},0);
}