Meteor collection update throws exception

My code:

try {
    Alerts.update({_id: alertId}, {
        $set: {
            number_of_new_results: 0,
            number_of_stored_results: 0,
            last_time_run: null
        }
    });
} catch (e) {
    console.log(e);
}

It generates the exception:

W20160421-16:17:37.739(2)? (STDERR) C:\Users\xauxatz\AppData\Local\.meteor\packages\npm-mongo\1.4.42\npm\node_modules\mongodb\lib\mongodb\connection\base.js:246
W20160421-16:17:37.739(2)? (STDERR)         throw message;      
W20160421-16:17:37.740(2)? (STDERR)               ^
W20160421-16:17:37.740(2)? (STDERR) RangeError: Maximum call stack size exceeded

I have absolutely no idea what’s causing the problem. This particular update works other places in the code.

The above code is running on the server, within:

if( Meteor.isServer ) {
    Meteor.methods({
.....................
    });
}

I found the error myself (as so often happens). The error resulted from a recursive call. The above code was called when a certain alert was updated. And the code within the function caused the alert to be updated again :frowning: