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

findandmodify incorrectly modifies/optimizes the query for the update operation

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 2.0.4
    • None
    • Internal Code
    • Linux. Looks like it happens everywhere, in the code.
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: