Python MongoDB

MongoDB Query

Querying documents

MongoDB Query

To query (search) for data in MongoDB, we can use the find() method with a query object.

Query Collection

myquery = { "address": "Park Lane 38" }
mydoc = mycol.find(myquery)
for x in mydoc:
    print(x)