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

Assertion in date indexes when opposite-direction-sorted and double "or" filtered

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.3, 2.6.4
    • Fix Version/s: 2.6.5, 2.7.7
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide

      Create a collection with at least 1 date field. Index the date field as ascending (1). Perform a query against the date with two filters and sort in the opposite direction of the index (-1)

      Recreating the index and rebuilding the database have no impact.

      Show
      Create a collection with at least 1 date field. Index the date field as ascending (1). Perform a query against the date with two filters and sort in the opposite direction of the index (-1) Recreating the index and rebuilding the database have no impact.

      Description

      When performing a find with two filters on the same indexed date field, a reverse sort on that same date field will cause an assertion:

      Assertion failure fieldsToExplode >= 1 src/mongo/db/query/planner_analysis.cpp 132

      Example:

      db.Coll.ensureIndex({"SomeDate.423.X": 1})
      db.Coll.find({ 
          $or: [ 
              { 
                  "SomeDate.423.X": { $gte: new Date(1388534400000), $lt: new Date(1420070400000) } 
              },
              { 
                  "SomeDate.423.X": { $gte: new Date(1356998400000), $lt: new Date(1388534400000) } 
              } 
              ]
          }).sort({ "SomeDate.423.X": -1 })

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: