Fix for using Atomic operations in update function

Added a function which rewrites update values to work with Atomic operations. More info on Atomic operations http://www.mongodb.org/display/DOCS/Atomic+Operations