Created
June 3, 2014 21:46
-
-
Save jeffbryner/773c31132f6b01645445 to your computer and use it in GitHub Desktop.
generate a meteor-style object ID from python for use in mongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def genMeteorID(): | |
return('%024x' % random.randrange(16**24)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See here for an implementation that's closer to Meteor's one and handles different sizes.
I'm shamelessly hi-jacking because this is the first result on Google for "meteor id python". ❤️