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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.5, 2.7.7
    • Affects Version/s: 2.6.3, 2.6.4
    • Component/s: 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.

      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 })
      

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

              Created:
              Updated:
              Resolved: