select * limit 100 equivalent in MongoDB using pymongo
<p>I am very new to MongoDB and using jupyter notebook for extracting data from mongodb. I am trying to fetch first 100 documents in MongoDB and i do have a crude way of fetching only 100 documents which is to add a counter and stop at 100th counter.</p>

<pre><code>#import library
import pymongo
from pymongo import MongoClient

#connect with mongo client
client = MongoClient('myipaddress', 27011)

db = client.mydatabase_test
collection = db.mycollection_in_testdatabase

#start counter
i=0
for obj in collection.find():
    if i &lt;= 100:
        print obj['dummy_column']
        i = i+1
    else:
        break
</code></pre>

<p>Is there any better way to do this in mongodb? I am sure there must be some equivalent of <code>select * from mydb limit 100</code> in mongodb. Can anyone help?</p>