title: How to limit mongo query in python
body: <p>I am trying to retrieve data from mongodb with python. My db contains lots of data. So I want to limit the data while retrieving. I tried</p>
  
  <pre><code>import datetime
  from pymongo import Connection
  connection = Connection('localhost',27017)
  db = connection['MyWork']
  
  
  db_data = db.myusers.find().limit(2)
  #db_data = db.myusers.find()[0:2]
  print db_data
  print db_data.count()
  print db_data[0]
  print db_data[1]
  print db_data[2]
  </code></pre>
  
  <p>But I am getting more than two documents when I tried above. I am using <code>pymongo</code> driver. How to limit the values</p>
  
  <pre><code>&lt;pymongo.cursor.Cursor object at 0x000000000267D518&gt;
  3
  {u'age': 24.0, u'_id': ObjectId('552b6e90aad3e2d909d5fb28'), u'place': u'Ravipadu', u'name': u'Shiva'}
  {u'age': 28.0, u'_id': ObjectId('552b6eabaad3e2d909d5fb29'), u'place': u'Rajahmundry', u'name': u'Anil'}
  {u'age': 30.0, u'_id': ObjectId('552b6ec1aad3e2d909d5fb2a'), u'place': u'Manchili', u'name': u'Kishore'}
  </code></pre>