def delete_entries(self, _id):
"""Delete entries in the Entries_Table
Args:
_id(str): Object ID of the entry you want to change
Return:
result(bool):true if the delete was successful. false if it fails
"""
entries_table = self.db["Entries_Table"]
try:
if not entries_table.find_one({"_id": ObjectId(_id)}):
# print "The specified entry does not Exist"
return False
entries_table.delete_one({"_id": ObjectId(_id)})
return True
except errors.ServerSelectionTimeoutError:
print('ERROR : No connection could be made because'
' the target machine actively refused it')
return False
评论列表
文章目录