code: function(connection) {
        // Create payload
        var payload = new Binary(f('\x00%s\x00%s', username, password));
  
        // Let's start the sasl process
        var command = {
          saslStart: 1,
          mechanism: 'PLAIN',
          payload: payload,
          autoAuthorize: 1
        };
  
        // Let's start the process
        server(
          connection,
          new Query(self.bson, '$external.$cmd', command, {
            numberToSkip: 0,
            numberToReturn: 1
          }),
          function(err, r) {
            // Adjust count
            count = count - 1;
  
            // If we have an error
            if (err) {
              errorObject = err;
            } else if (r.result['$err']) {
              errorObject = r.result;
            } else if (r.result['errmsg']) {
              errorObject = r.result;
            } else {
              numberOfValidConnections = numberOfValidConnections + 1;
            }
  
            // We have authenticated all connections
            if (count === 0 && numberOfValidConnections > 0) {
              // Store the auth details
              addAuthSession(self.authStore, new AuthSession(db, username, password));
              // Return correct authentication
              callback(null, true);
            } else if (count === 0) {
              if (errorObject == null)
                errorObject = new MongoError(f('failed to authenticate using mongocr'));
              callback(errorObject, false);
            }
          }
        );
      }
docs: Execute MongoCR