pythonmongodbpymongomongokit

How to pass an array of conditions in mongokit find query


How can i pass array of condtions in mongokit find query.

Untill now , i am implementing queries like :

data = db.entry.find({'title':{'$regex':'test'},'status':{'$regex':'active'}}).limit(3);

Condtions are bound to increase. Is there any way i can pass an array of conditions?


Solution

  • conditions = {'title':{'$regex':'test'},'status':{'$regex':'active'} ..... other conditions }
    data = db.entry.find(conditions).limit(3);