bson.NewObjectId(), "random" value

64 wyświetlenia
Przejdź do pierwszej nieodczytanej wiadomości

Klaus Post

nieprzeczytany,
20 mar 2014, 05:44:1420.03.2014
do mgo-...@googlegroups.com
Hi!

I am experimenting with the mgo driver, and it seems really awesome! I really like the way you work with this driver!

A colleague noticed something about the object ID's that mgo creates. According to the Mongo recommendations the lowest significant bytes should be "a 3-byte counter, starting with a random value." It seems like mgo always starts with the value '1' instead of using a random value.

Is there a reason it is always initialized to 0? I can see there is no chance of collision since it is incremented atomically.

My colleague however is a little concerned that Mongo could use the value for index tree construction or something similar that would rely on the value to be random for more even tree splitting.

Would it be a big change to make him happy and initialize it to a random value?



Best regards,

Klaus Post

Klaus Post

nieprzeczytany,
20 mar 2014, 08:38:2920.03.2014
do mgo-...@googlegroups.com
Of course there is an xkcd: http://xkcd.com/221/
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0