-
Type: New Feature
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Write Ops
-
None
-
Query
Right now, you can't access the old value of a row during an update. You have to decide what each field you want to update should look like on the client side. So you can't do:
{ $set : { "creation_timestamp" : coalesce(old.creation_timestamp, <now>) }}
or:
{ $set : { "priority" : max(old.priority, 3) }}
or:
{ $set : { "widgets_being_processed" : old.widgets_needing_processing }}
... or any equivalent.
You can do this kind of thing with two queries, but that has potential performance and concurrency problems.
From what I know of the Mongo architecture I don't see why access to this information should be impossible. I don't know what the syntax would be, of course.
See also my original email question: http://groups.google.com/group/mongodb-user/browse_thread/thread/1c7b424cf9ef48e8/877621f662ca4cc0
- is duplicated by
-
SERVER-20510 Add stored procedure functionality
- Closed
- is related to
-
SERVER-458 JavaScript $function in update
- Closed
-
SERVER-11345 Allow update to compute expressions using referenced fields like Aggregation Framework's $project
- Closed