[10:56:04] <jost> Hi! I want to insert something into the database, but if the _id already exists, I want an exception. Doing 2 queries (checking for existence, then updating) may go wrong because of concurrency. Just inserting should just work, and fail if the _id-value is already there, on any shard?
[10:57:59] <jost> (I'm using spring datas mongodb adapter, if that matters)
[13:04:46] <bakhtiyor> does mongodb _id field required objectid type or doesn't matter? i want to store 12-byte hex string
[13:07:34] <kali> bakhtiyor: i assume you're aware _id can not be changed too
[13:10:16] <kali> bakhtiyor: you can also consider using a Binary. it will be as compact as ObjectId, with no assumption on the actual content (or length)
[13:10:48] <bakhtiyor> kali: thanks, still more disadvantages with string?
[13:10:50] <kali> bakhtiyor: finally, there is something nice about objectid: they start by a timestamp. sometimes it's nice to get a free "creation date" ordering