Depending on who inserts into the database and at what rate, you could either simply use a timestamp on insertion or do a simulation of an autoincrementing field.
The timestamp method is way easier but at a high rate of insertions it can lead to several documents having the same timestamp.
The AutoIncrement way is a bit more cumbersome as MongoDB doesn’t have an innate ability to do that - someone correct me if I’m wrong there.
Basically, you’ll first have to search for the last index, increment it by one and then insert a new document with the new index.
However, at a high rate of insertions this may run into the same problem as the timestamps.
You may try this, however, using the module mongodb-autoincrement on the server: