How to use the loopback-connector.Connector.defineAliases function in loopback-connector

To help you get started, we’ve selected a few loopback-connector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-connector-mongodb / lib / mongodb.js View on Github external
this.execute(modelName, 'findOne', {_id: oid}, function(err, data) {
    if (self.debug) {
      debug('find.callback', modelName, id, err, data);
    }

    data = self.fromDatabase(modelName, data);
    if (data && idName !== '_id') {
      delete data._id;
    }
    if (callback) {
      callback(err, data);
    }
  });
};

Connector.defineAliases(MongoDB.prototype, 'find', 'findById');

/**
 * Parses the data input for update operations and returns the
 * sanitised version of the object.
 *
 * @param data
 * @returns {*}
 */
MongoDB.prototype.parseUpdateData = function(modelName, data, options) {
  options = options || {};
  const parsedData = {};

  const modelClass = this._models[modelName];

  let allowExtendedOperators = this.settings.allowExtendedOperators;
  if (options.hasOwnProperty('allowExtendedOperators')) {