Fix AttributeError caused by updated pymongo version