Tag: nosql
-
MongoDB – Incremental IDs
I’ve been reading a lot recently on MongoDB and the use of incrementing an ID This article offers an in depth look: http://shiflett.org/blog/2010/jul/auto-increment-with-mongodb Taking this a little further, and from reading the findAndModify documentation I put together the following: db.sequence.findAndModify({ query: {“_id”: “customer”}, update : {$inc : {“seq”:1}}, upsert:true, new:true}) Here is what this command…