title: How to store large numbers in MongoDB with Node.js
body: <p>I am using MongoDB with the native node driver and need to accurately store numbers that may be larger than the int maximum 2147483647. I will need to be able to increment the number as I am tracking usage. What are my options?</p>
  
  <p>I am using Mongoose. The problem I am having is that when I <code>$inc</code> past 2147483647 it converts the number to a double. How can I force Mongoose to use the 64-bit long int <code>NumberLong</code>?</p>
  
  <p>My schema looks like this</p>
  
  <pre><code>var schema = new Schema({
      ...
      usedBandwidth: {type: Number, min: 0, default: 0}
  });
  </code></pre>
  
  <p>And my <code>$inc</code> looks like this</p>
  
  <pre><code>model.Account.update(
      {_id: this.account},
      {$inc: {usedBandwidth: this.size}},
      function (err, doc) {}
  );
  </code></pre>