def update(self, key, data):
""" Affects only the keys in `data` """
write = copy.copy(data)
current = self.get(key)
current.update(write)
response = self.save(key, data) if current == self.get(key) else False
# experimental
# user should check response is not False to ensure successful update
if not response:
LOG.error("DB UPDATE: %s.%s | Document changed during update!",
self.collection_name, response)
else:
LOG.info("DB UPDATE: %s.%s", self.collection_name, response)
return response
Created
December 17, 2013 17:17
-
-
Save stavxyz/8008754 to your computer and use it in GitHub Desktop.
mongodb concurrency
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment