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

Equality-indexed field cannot use $in in aggregation.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization
    • ALL
    • Hide

      Schema:

      {
          encryptedFields: {
              "fields": [
                  {
                      path: "age",
                      bsonType: "int",
                      queries: {queryType: "range", min: NumberInt(0), max: NumberInt(255), sparsity: 1}
                  },
                  {path: "zipcode", bsonType: "string", "queries": {"queryType": "equality"}},
              ]
          }
      }
      

      Query:

      {
          $and: [
              {$gte: ["$age", NumberInt(22)]},
              {$lt: ["$age", NumberInt(25)]},
              {$in: ["$zipcode", ["098765", "ABCDE", "1257"]]}
          ]
      }
      

      Show
      Schema: { encryptedFields: { "fields": [ { path: "age", bsonType: "int", queries: {queryType: "range", min: NumberInt(0), max: NumberInt(255), sparsity: 1} }, {path: "zipcode", bsonType: "string", "queries": {"queryType": "equality"}}, ] } } Query: { $and: [ {$gte: ["$age", NumberInt(22)]}, {$lt: ["$age", NumberInt(25)]}, {$in: ["$zipcode", ["098765", "ABCDE", "1257"]]} ] }
    • QO 2022-10-31

    Description

      Query analysis seems overly eager and errors when $in is used, even with an equality index, failing with the error: "ExpressionIn with RangeIndex not yet supported". The range intender should check if the field being operated on is indexed with range before asserting.

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            davis.haupt@mongodb.com Davis Haupt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: