title: Saving money as integer
body: <p>We have the following code in Mongoose schema trying to convert money to integer to save in MongoDB:</p>
  
  <pre><code>amount: { type: Number, get: getAmount, set: setAmount, required: true}
  
  function setAmount(num) {
    return num * 100;
  }
  
  function getAmount(num) {
    return (num / 100).toFixed(2);
  }
  </code></pre>
  
  <p>However saving <code>64.49</code> we still end up with this in MongoDB documents:</p>
  
  <pre><code>"amount": 6448.999999999999
  </code></pre>
  
  <p>How do we fix this?</p>