Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1765

self referential updates? WAS: allow access to old row value during update

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Write Ops
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                31 Vote for this issue
                Watchers:
                30 Start watching this issue

                Dates

                • Created:
                  Updated: