Python MongoDB

MongoDB Limit

Limiting results

MongoDB Limit

To limit the result in MongoDB, we use the limit() method.

Limit Results

myresult = mycol.find().limit(5)
for x in myresult:
    print(x)