title: generate unique id in nested document - Pymongo
body: <p>generate unique id in nested document - Pymongo</p>
  
  <p>my database looks like this...</p>
  
  <pre><code>{
    "_id":"5ea661d6213894a6082af6d1",
  
    "blog_id":"blog_one",
  
    "comments":  [
            {
              "user_id":"1",
              "comment":"comment for blog one this is good"
            },
            {
              "user_id":"2",
              "comment":"other for blog one"
            },
    ]
  }
  </code></pre>
  
  <p>I want to add unique id in each and every comment,</p>
  
  <p>I want it to output like this,</p>
  
  <pre><code>{
    "_id":"5ea661d6213894a6082af6d1",
  
    "blog_id":"blog_one",
  
    "comments": [
             {
              "id" : "something"     (auto generate unique),
              "user_id":"1",
              "comment":"comment for blog one this is good"
             },
             {
              "id" : "something"    (auto generate unique),
              "user_id":"2",
              "comment":"other for blog one"
             },
       ]
  }
  </code></pre>
  
  <p>I'm using PyMongo, is there a way to update this kind of document?</p>
  
  <p>it's possible or not? </p>