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

findandmodify incorrectly modifies/optimizes the query for the update operation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: Internal Code
    • Environment:
      Linux. Looks like it happens everywhere, in the code.
    • Operating System:
      Linux

      Description

      Console session: https://gist.github.com/3355357

      Take a look at the query for the update (at line 44). Seems MongoDB is rewriting my query, but it leaves the original query in place. (See also the comments on this gist; there's some insight in the code, but not much.)

      The reason I stumbled upon this is that I was trying to do some scripted explains on my profile data, and got something like this: http://paste.roguecoders.com/p/efd3829bba5ab5fd19ba8bb1a073da6a.txt

      Note the second clause (which should be entirely redundant because Mongo is selecting one explicit unique record (the _id)). This gives me an empty BasicCursor.

      From here: https://groups.google.com/d/topic/mongodb-user/we4kDRdE4GM/discussion (Kristina and Derick both suggested I file this in Jira).

        Attachments

          Activity

            People

            Assignee:
            aaron Aaron Staple
            Reporter:
            scoates Sean Coates
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: