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

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.6.3, 2.6.4
    • 2.6.5, 2.7.7
    • Querying
    • None
    • ALL
    • 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

            david.storch@mongodb.com David Storch
            sallgeud Chad Kreimendahl
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: