title: How to create a worldwide unique GUID/UUID system for Mongo with Python?
body: <p>In the Mongo docs, it states the following: </p>
  
  <blockquote>
    <p>The _id field can be of any type; however, it must be unique. Thus you
    can use UUIDs in the _id field instead of BSON ObjectIds (BSON
    ObjectIds are slightly smaller; they need not be worldwide unique,
    just unique for a single db cluster). When using UUIDs, your
    application must generate the UUID itself. Ideally the UUID is then
    stored in the [DOCS:BSON] type for efficiency – however you can also
    insert it as a hex string if you know space and speed will not be an
    issue for the use case.</p>
  </blockquote>
  
  <p>So that being the case, can someone walk me through how I can create a bullet-proof, worldwide unique GUID in [DOCS:BSON] format for all my Mongo documents? I want to make sure that at no point will I have duplicate GUIDs, even across clusters. Does anyone have any experience with or ideas for best practices when it comes to Mongo and GUIDs? Would it  be easier to use Mongos native ID system, but check for duplicates before inserting and generating a new ObjectID if need be?</p>