changed to use pymongo