title: Cannot make virtual fields work in Sequelize
body: <p>I have exhausted everything I can find here and elsewhere. It appears others are having success but nothing I do will allow me to see any virtual fields. I have tried both as fields and as getterMethods to no avail. I have made sure latest Sequelize version is installed in my project.</p>
  
  <p>Here is the object definition:</p>
  
  <pre><code>var Orderitem = sequelize.define("Orderitem", {
      description: { type: DataTypes.STRING(80), allowNull: false },
      quantity: { type: DataTypes.DECIMAL(9,2), allowNull: false, defaultValue: 0},
      unitWeight: { type: DataTypes.DECIMAL(9,2), allowNull: false, defaultValue: 0},
      price: { type: DataTypes.DECIMAL(9,2), allowNull: false, defaultValue: 0},
  
      totalPrice: { 
        type: DataTypes.VIRTUAL(DataTypes.DECIMAL(9,2), ['price', 'quantity']),
        get() {
          //return this.getDataValue('unitWeight') * this.getDataValue('quantity');
          return 195.99;
        }
      }, 
      totalWeight: { 
        type:  DataTypes.VIRTUAL(DataTypes.DECIMAL(9,2), ['unitWeight', 'quantity']),
        get() {
          //return this.getDataValue('unitWeight') * this.getDataValue('quantity');
          return 45;
        }
      },
    }, {
  /*
      getterMethods: {
        testFoo: function () {
            return 'Foo';
        },
        totalPrice: function () { 
          return  this.getDataValue('price') * this.getDataValue('quantity');
        },
        totalWeight: function() {
          return this.getDataValue('unitWeight') * this.getDataValue('quantity');
        }
      },
  */
      classMethods: {
        associate: function(models) {
          Orderitem.belongsTo(models.Order, {onDelete: 'CASCADE'})
      }
  }
  </code></pre>
  
  <p>As quoted, it is trying to use attribute definitions with VIRTUAL type. I have also tried with <em>just</em> virtual, no additional type or dependencies. For testing I've also hardcoded sample return values.</p>
  
  <p>The alternative of using getterMethods (commented out here) fares no better.</p>
  
  <p>According to everything I can find, I should be able to perform a find (findOne, findAll, etc) and these should be returned as fields along with all the others. The first 4 fields return expected values from the database. The virtual fields are nowhere to be found. Using either method above, what am I doing wrong?</p>
  
  <p>Retrieval code is:</p>
  
  <pre><code>OrderController.items = function (orderId, callback) {
      models.Orderitem.findAll({
          //attributes: Object.keys(models.Orderitem.attributes).concat([ 'totalPrice','totalWeight']),
          where: {orderId: orderId}, raw: true
      }).then(function(orderitems) {
          callback(null, orderitems)
      }).catch(function(error) {
          callback(error, null)
      });
   };
  </code></pre>
  
  <p>There is no errors, the items are retrieved as expected, everything works perfectly *except the virtual fields. They are simply not there to be found. requesting raw or full objects makes no difference.</p>