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

findandmodify incorrectly modifies/optimizes the query for the update operation

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.4
    • Component/s: Internal Code
    • Environment:
      Linux. Looks like it happens everywhere, in the code.
    • Linux

      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).

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

              Created:
              Updated:
              Resolved: