PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 2nd of January, 2020

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[10:57:29] <zelest> GothAlice, awake? :)
[10:57:46] <zelest> GothAlice, actually, nevermind.. O:)
[14:04:53] <GothAlice> Zta77: All drivers generate IDs on the fly upon insert.
[14:05:16] <GothAlice> IDs are a "client-side" (i.e. application) concern, not the MongoDB database server's.
[14:07:05] <GothAlice> To the point that my DAO layer eagerly creates them, prior to persisting the record, permitting you to create complete graphs of objects with intra-object references, then persist in a batch, and have a viable graph as a result. http://f.cl.ly/items/3m1B0X2o0d0k0U42472E/why-wait-for-server-persistence--generate-early%21.png
[22:35:47] <Zta77> GothAlice: I didn't understand much of that, except that ids are the application's responsibility; not mongodb server's. But wouldn't that mean that I would be able to have my application fully control the generation of ids? And do something like I proposed? I mean keep using the PojoCode, not have my domain models "polluted" with an ObjectId field, and have that primary key generated based in another field in the model (in my case,
[22:35:47] <Zta77> a date (epoch long)).
[22:38:02] <Zta77> Perhaps running this prior to inserting anything will accomplish what I want? collection.createIndex(new BasicDBObject("date", 1));
[22:43:22] <Zta77> Maybe I'm intending to use the pk the wrong way. I basically want to ensure that no entries with equal 'date' are inserted.
[22:45:41] <Zta77> Maybe? collection.createIndex(new BasicDBObject("date", 1), new IndexOptions().unique(true));
[22:54:33] <Zta77> =)