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

textIndexVersion compatibility check not complete

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.9
    • Affects Version/s: 2.4.7, 2.5.3
    • Component/s: Text Search
    • None
    • ALL

      Issue Status as of December 30th, 2013

      Text indexes created with ensureIndex in mongod 2.6 are created with a new index format that is incompatible with mongod 2.4. mongod 2.4.8 and earlier do not recognize the fact that the index format is incompatible, such that if the contents of the collection are changed the text index may be left in an invalid state.

      After downgrading to mongod 2.4.8 or earlier and changing the collection contents, the "text" command may return incorrect results. In addition, if at a later point mongod 2.6 is used with this collection, the $text query operator may match incorrect documents.

      mongod v2.4.9 will correctly forbid changes to collections that have a text index which is incompatible with 2.4. Attempts to insert, update, or remove documents in these collections will return the error message "attempt to use unsupported textIndexVersion 2, only textIndexVersion 1 supported".


      Production release v2.4.9 contains the fix for this issue. When downgrading mongod 2.6 => 2.4, always downgrade to mongod 2.4.9 or later to avoid this issue.

      Original Description

      The textIndexVersion compatibility check (in both master and the 2.4 branch) is only run during index builds (FTSSpec::fixSpec()). It needs to also be run at time of query/command execution (FTSSpec ctor).

      A consequence of the above fact is that already-released versions of 2.4 treat textIndexVersion:2 indexes as textIndexVersion:1. It will thus be undefined behavior to downgrade a database with a textIndexVersion:2 text index (i.e. one created with 2.6) to 2.4.8 or earlier.

            rassi J Rassi
            rassi J Rassi
            0 Vote for this issue
            5 Start watching this issue