Tangkap Kesalahan dalam Mongo Query Python
try:
connection.test.foo.find_one()
except pymongo.errors.OperationFailure:
print "caught"
Good Grivet
try:
connection.test.foo.find_one()
except pymongo.errors.OperationFailure:
print "caught"