app/imports/api/user/UserCollection.js
/**
   * Updates the given document.
   * @param username: the username of the user.
   * @param autoMPG: the mpg of the user's vehicle.
   * @param homeRoundTrip: the round trip distance between the user's house and their work.
   */
Updates the given document.
@param username: the username of the user.
@param autoMPG: the mpg of the user's vehicle.
@param homeRoundTrip: the round trip distance between the user's house and their work.
Updates the given document . @param username : the username of the user . @param autoMPG : the mpg of the user ' s vehicle . @param homeRoundTrip : the round trip distance between the user ' s house and their work .
update(docID, { username, autoMPG, homeRoundTrip }) {
    const updateData = {};
    if (username) {
      updateData.username = username;
    }
    if (_.isNumber(autoMPG)) {
      updateData.autoMPG = autoMPG;
    }
    if (_.isNumber(homeRoundTrip)) {
      updateData.homeRoundTrip = homeRoundTrip;
    }
    this._collection.update(docID, { $set: updateData });
  }
update ( docID , { username , autoMPG , homeRoundTrip } ) { const updateData = { } ; if ( username ) { updateData . username = username ; } if ( _ . isNumber ( autoMPG ) ) { updateData . autoMPG = autoMPG ; } if ( _ . isNumber ( homeRoundTrip ) ) { updateData . homeRoundTrip = homeRoundTrip ; } this . _collection . update ( docID , { $set : updateData } ) ; }
Updates the given document.
Updates the given document .
// if (distance) { NOTE: 0 is falsy so we need to check if the quantity is a number.