title: Incrementing a value with mongoose?
body: <p>I have a <code>mongoose</code> model in my <code>node.js</code> application, representing invoices. I have figured most of it out already, but I really need to ensure that my invoices are numerated/incremented to be able to provide a proper reference to my customer. </p>
  
  <p>Using an SQL database, I would have created an <code>AUTO-INCREMENT</code> column holding this value, but this obviosly isn't built into MongoDB. So how would I accomplish this with <code>mongoose</code>?</p>
  
  <p>Here's how my model looks right now:</p>
  
  <pre><code>var InvoiceSchema = new Schema({
      reference: {type: Number, default: 0}, // The property I want to auto-incr.
  
      dates: {
          created:  {type: Date, default: Date.now},
          expire: {type: Date, default: expiryDate()}
      },
  
      amount: {type: Number, default: 0}
      // And so on
  });
  </code></pre>