args[idx] = function()

in src/plugins/MongoDBPlugin.ts [55:64]


      args[idx] = function (this: any) {
        // arguments = [error: any, result: any]
        span.mongodbInCall = false; // we do this because some operations may call callback immediately which would not create a new span for any operations in that callback (db.collection())

        if (arguments[0]) span.error(arguments[0]);

        if (arguments[0] || !plugin.hookCursorMaybe(span, arguments[1])) span.stop();

        return callback.apply(this, arguments);
      };