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

Command error on specific combination of compound index

    XMLWordPrintable

Details

    • Fully Compatible
    • ALL
    • QE 2022-08-08

    Description

      I have a collection with an index declared as: ({siteId: 1, startDate:1, endDate: 1}, {collation: {"locale": "en"}}).

      Some aggregate queries generate database errors, such as:

       

      {
        "aggregate" : "MyColl",
        "pipeline" : [{
            "$match" : {
              "siteId": {
                "$oid": "5bfeb296db127e1168efbf13"
              },
              "$or" : [{
                  "startDate" : null
                }, {
                  "startDate" : {
                    "$gte" : "2022-01-01"
                  }
                }]
            }
          }, {
            "$sort" : {
              "startDate" : 1,
              "endDate" : 1
            }
          }],
        "collation" : {
          "locale" : "en"
        }
      }

      The database responds:

       

      {
        "ok" : 0.0,
        "errmsg" : "assertion src/mongo/bson/bsonobjbuilder.h:195",
        "code" : 8,
        "codeName" : "UnknownError"
      }

      It only occurs when there are matches where the startDate field is null (undefined).

      Attachments

        1. CompassError.png
          CompassError.png
          85 kB
        2. DataExample.json
          2 kB
        3. mongoLogs.txt
          37 kB

        Activity

          People

            denis.grebennicov@mongodb.com Denis Grebennicov
            manuel.cabral@vooban.com Manuel Cabral
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: