Question

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?

Was it helpful?

Solution

conditions = {'title':{'$regex':'test'},'status':{'$regex':'active'} ..... other conditions }
data = db.entry.find(conditions).limit(3);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top