MongoDB
 sql >> Datenbank >  >> NoSQL >> MongoDB

Meteor:Meteor.call() innerhalb des Observe-Callbacks wird nicht ausgeführt

Dies könnte ein bekanntes Problem sein, ich bin mir nicht sicher, da ich es nicht selbst ausprobiert habe, aber es sieht so aus, als ob es eine Problemumgehung geben könnte (siehe https://github.com/meteor/meteor/issues/907 )

Fügen Sie Ihren Meteor.call hinzu in einen sofortigen 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);
}