replace deprecated safe=True arguments for pymongo