title: How to autoincrement id at every insert in Pymongo?
body: <p>I am using pymongo to insert documents in the mongodb.
  here is code for router.py file</p>
  
  <pre class="lang-python prettyprint-override"><code>    temp = db.admin_collection.find().sort( [("_id", -1)] ).limit(1)
      for doc in temp:
          admin_id = str(int(doc['_id']) + 1)
  
  
      admin_doc ={
      '_id'       :   admin_id,
      'question'  :   ques,
      'answer'    :   ans,
      }
      collection.insert(admin_doc)
  </code></pre>
  
  <p>what should i do so that at every insert _id is incremented by 1.</p>