No, you cannot refer to values in the found document during the update portion of a findAndModify
. It's the same as update
in this respect.
As such, you cannot do this atomically as you need to first fetch the document and then craft the update
or findAndMondify
to contain the value computed from your fetched doc.
See https://jira.mongodb.org/browse/SERVER-458 for one way this may be addressed in the future.