Example #1
0
  function removeModel() {

    if (from === 'market') {
      return addModel();
    }

    var selector = {
      _id: from
    };

    var data = {
      $pull: {
        roaster: modelId
      }
    };

    User.update(selector, data, addModel);

  }
Example #2
0
  function addModel(err) {

    if (err) {
      return next(err);
    }

    if (to === 'market') {
      return writeResponse();
    }

    var selector = {
      _id: to
    };

    var data = {
      $push: {
        roaster: modelId
      }
    };

    User.update(selector, data, writeResponse);

  }