Re: voyage/mongo randomly wrong OIDs
Posted by
Stéphane Ducasse on
Aug 31, 2013; 11:47am
URL: https://forum.world.st/voyage-mongo-randomly-wrong-OIDs-tp4705396p4705912.html
Sabine
what we could do is to propose a "subclass of UUID" and to group several UUID generators.
Like that with a couple of classes, we could get a better eco system where people can pick the one they want.
stef
Hi Esteban,
yes, Mongo is not very communicative ;-)
I replaced OID>>nextOID with my own RKAOIDGenerator
nextOID
^self value: (RKAOIDGenerator getNextOID)
instead of
nextOID
^self value: (UUIDGenerator default makeSeed)
RKAOIDGenerator uses Time>>primMillisecondClock at startup and adds +1 each time I getNextOID as you suggested.
This works fine. It seems to be much much much faster than the existing solution.
[4000 timesRepeat: [UUIDGenerator default makeSeed]] timeToRun ==>> 5817
[4000 timesRepeat: [RKAOIDGenerator getNextOID]] timeToRun ==> 1 (!!)
Perhaps a solution like this would be a better solution for all because it is faster and guarantees unique IDs?
Sabine
View this message in context: Re: voyage/mongo randomly wrong OIDs
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.