PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 17th of September, 2019

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:15:02] <synthmeat> eh. gotta read from primary then :)
[00:49:38] <GothAlice> Or don't lock-step your reads with writes such that race conditions can even exist in the first place.
[12:12:11] <synthmeat> GothAlice: i'm weirded out with how even with w: 4 (pri/sec/sec/sec(hidden,0,0)) and readConcern level majority, it was still failing
[12:13:15] <synthmeat> so far, i'm blaming it on myself for not figuring out writeconcern/readconcern syntax or smth. alternative is - mongodb is wrong :/
[12:27:31] <GothAlice> When using JavaScript, never blame on external factors that which is adequately explained by JavaScript. typeof "a string" !== typeof new String("also a string") >:P
[21:15:24] <Intelo> when I insert in mongo, does it creates its on objectId (the primary key) or I can insert it too my self ?
[21:21:40] <GothAlice> Intelo: Both. Notably, the server-side MongoDB service will add _id keys with immediately-generated ObjectId values, if missing, and application-side drivers automatically add a _id key with an immediately-generated ObjectId value before passing off to the server, and you can generate your own. MongoDB doesn't do silly things like provide a "save" call which might need to differentiate between existing records to update and new
[21:21:40] <GothAlice> records to insert, it provides extremely clear and unambiguous insert calls v. update calls.
[21:22:21] <GothAlice> Providing your own _id, if the primary key would violate the unique constraint, the insert will fail.
[21:23:02] <GothAlice> Intelo: My own DAO layer also will automatically add and populate _id, if using the "identified" mix-in trait: https://github.com/marrow/mongo/blob/develop/marrow/mongo/core/trait/identified.py?ts=4
[21:23:04] <Intelo> GothAlice, if my provided uuid is unique for sure, then I can provide my own everytime?
[21:24:10] <GothAlice> a) UUIDs aren't guaranteed unique. b) the answer does not change: "and you can generate your own" (where "generate" means "supply any value", here).
[21:24:53] <GothAlice> Even though "unique" is in their name, if you're using UUID4's, they represent a statistical probability of collision on every generation.
[21:29:16] <Intelo> GothAlice, really? collision for v4?
[21:30:17] <GothAlice> "Random". 1,2,3,4 and 1,2,3,4 are just as likely as any other sequence of "four consecutive integers" when generating the list randomly. Every generation represents a possible collision as a result.
[21:30:59] <GothAlice> Until MongoDB changed the definition of ObjectId to make the host+process identification region purely random, ObjectId did have some guarantees as to uniqueness. You could generate just over 16.777 million IDs per second from a single process on a single host before encountering a single collision. Guaranteed.
[21:31:27] <GothAlice> But then they changed it so the host+process section is random, resulting in a statistical probability of collision becoming possible on every application startup.
[21:31:30] <GothAlice> Genius!
[21:32:38] <GothAlice> https://github.com/marrow/mongo/blob/next/marrow/mongo/util/oid.py?ts=4 ← for more information than most people probably want or need. (I had to write my own ObjectId implementation, because MongoDB, Inc. borked the bson.ObjectId one. :shakes fist:)