如何选择 PyMongo 只有唯一的记录?
>>> db.houses.find({"street":{"$regex": "Fl", "$options":"i"}}).count()
107
>>> for item in db.houses.find({"street":{"$regex": "Fl", "$options":"i"}}):
... print item["street"]
...
Flatbush Avenue
Flatbush Avenue
Flatbush Avenue
Flatlands Avenue
Flatlands Avenue
Flatlands Avenue
Flatlands Avenue
Flatlands Avenue
Flushing Avenue
Flushing Avenue
...more
如何在响应查询时获得唯一的“街道”记录?也就是说,为了避免重复记录:
Flatbush Avenue
Flatlands Avenue
Flushing Avenue