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

Update with $text only updates half of matching docs if docs have moved

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.5
    • Component/s: Text Search, Write Ops
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Can't reproduce on 2.5.4, can reproduce on master: 9cfca59caf6426bf3c14fa3730aa58003b223386

      db.test.drop()
      db.test.insert({ a: "dog" })
      db.test.insert({ a: "dog" })
      db.test.ensureIndex({ a: "text" })
      db.test.update(
          { $text: { $search: "dog" } },
          { $set: { b: 1 } },
          { multi: true }
      )
      assert.eq(db.test.count({ b: 1 }), 2)

      Show
      Can't reproduce on 2.5.4, can reproduce on master: 9cfca59caf6426bf3c14fa3730aa58003b223386 db.test.drop() db.test.insert({ a: "dog" }) db.test.insert({ a: "dog" }) db.test.ensureIndex({ a: "text" }) db.test.update( { $text: { $search: "dog" } }, { $set: { b: 1 } }, { multi: true } ) assert.eq(db.test.count({ b: 1 }), 2)

      Description

      Updates with a text predicate does not update all of the matched documents if the update results in moves. It seems to update half of those that matched (if 8 match 4 get updated, if 2 match 1 gets updated).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: