I have a model mongoosein my application node.jsthat represents invoices. I understood this a long time ago, but I really need to ensure that my invoices are calculated / increased in order to provide the proper link to my client.
Using an SQL database, I would create a column AUTO-INCREMENTcontaining this value, but this is not obviosly built into MongoDB. So how would this be done with mongoose?
Here's what my model looks like right now:
var InvoiceSchema = new Schema({
reference: {type: Number, default: 0},
dates: {
created: {type: Date, default: Date.now},
expire: {type: Date, default: expiryDate()}
},
amount: {type: Number, default: 0}
});
source
share