I have the following python script:
import pdb
import sys
import os
import csv
import pymongo
from pymongo import MongoClient
def main():
pass
def getWholeCollection(collection_name):
for property in collection_name.find("{"zip":33801}"):
print property
if __name__ == '__main__':
client = MongoClient()
data_base = client.hkpr_dbw
properties_collection = data_base.properties
getWholeCollection(properties_collection)
I keep getting an error around {"zip":33801} which works fine in the mongo shell. I tried """{"zip":33801}""".
I'd like to make the query a variable at some point. How do I use these strings?
for property in collection_name.find({"zip":33801}):