Raise NotUniqueError in Document.update() on pymongo.errors.DuplicateKeyError
This commit is contained in:
parent
d4b3649640
commit
803caddbd4
@ -443,6 +443,8 @@ class BaseQuerySet(object):
|
|||||||
return result
|
return result
|
||||||
elif result:
|
elif result:
|
||||||
return result['n']
|
return result['n']
|
||||||
|
except pymongo.errors.DuplicateKeyError, err:
|
||||||
|
raise NotUniqueError(u'Update failed (%s)' % unicode(err))
|
||||||
except pymongo.errors.OperationFailure, err:
|
except pymongo.errors.OperationFailure, err:
|
||||||
if unicode(err) == u'multi not coded yet':
|
if unicode(err) == u'multi not coded yet':
|
||||||
message = u'update() method requires MongoDB 1.1.3+'
|
message = u'update() method requires MongoDB 1.1.3+'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user