Skip to main content

Generate a random MongoDB ObjectId.

Project description

Random ObjectId

Wheel Status


This is a toy project without any outlandish goals. Occasionally I needed a MongoDB ObjectID for a unit test. This saves a DB query, starting mongo locally, writing more than a line of Python, or visiting a website. I also wanted to learn more about writing & deploying Python packages.




py36+. See GitHub workflow here.


$ pip install random-object-id


$ random_object_id -h
usage: random_object_id [-h] [-l]

Generate a random MongoDB ObjectId

optional arguments:
  -h, --help      show this help message and exit
  -l, --longform  prints the ID surrounded by ObjectId("...")
from random_object_id import generate

generate()  # => '5ecd3bbf875e60b4166f6699'


$ random_object_id
$ random_object_id -l

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for random-object-id, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size random_object_id-2.0.0-py2.py3-none-any.whl (3.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size random_object_id-2.0.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page