src/plugins/plugin-mongodb-core.js
function wrapCallback(api, span, done) {
  var fn = function(err, res) {
    if (api.enhancedDatabaseReportingEnabled()) {
      if (err) {
        // Errors may contain sensitive query parameters.
        span.addLabel('mongoError', err);
      }
      if (res) {
        var result = res.result ? res.result : res;
        span.addLabel('result', result);
      }
    }
    span.endSpan();
    if (done) {
      done(err, res);
    }
  };
  return api.wrap(fn);
}
function wrapCallback(api, span, done) {
  var fn = function(err, res) {
    if (api.enhancedDatabaseReportingEnabled()) {
      if (err) {
        // Errors may contain sensitive query parameters.
        span.addLabel('mongoError', err);
      }
      if (res) {
        var result = res.result ? res.result : res;
        span.addLabel('result', result);
      }
    }
    span.endSpan();
    if (done) {
      done(err, res);
    }
  };
  return api.wrap(fn);
}
function wrapCallback ( api , span , done ) { var fn = function ( err , res ) { if ( api . enhancedDatabaseReportingEnabled ( ) ) { if ( err ) { // Errors may contain sensitive query parameters. span . addLabel ( 'mongoError' , err ) ; } if ( res ) { var result = res . result ? res . result : res ; span . addLabel ( 'result' , result ) ; } } span . endSpan ( ) ; if ( done ) { done ( err , res ) ; } } ; return api . wrap ( fn ) ; }
Wraps the provided callback so that the provided span will
be closed immediately after the callback is invoked.

@param {Span} span The span to be closed.
@param {Function} done The callback to be wrapped.
@return {Function} The wrapped function.
Wraps the provided callback so that the provided span will be closed immediately after the callback is invoked .