I am using pymongo to query for all items in a region (actually it is to query for all venues in a region on a map). I used db.command(SON()) before to search i
db.command(SON())
Map function is fast way to convert big collection
from time import time cursor = db.collection.find() def f(x): return x['name'] t1 = time() blackset = set(map(f, cursor)) print(time() - t1)