I have a web page where users can see data from MongoDB on a map. I want to have several check boxes, radio buttons, etc to filter what is seen on the map. If I was using MySQL I would do
query = "SELECT * FROM table WHERE x = 1"
if checkbox == "checked":
query += "AND WHERE y = 2"
How can I replicate that with pymongo?
You simply build up the query dict instead:
Doing an
ORquery would look like this: