Uploaded image for project: 'MongoDB for IntelliJ Plugin'
  1. MongoDB for IntelliJ Plugin
  2. INTELLIJ-265

Index consolidation must not consider empty indexes as covered on unsupported queries

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • Developer Tools

      Problem Statement/Rationale

      What is going wrong? What action would you like the Engineering team to take?

      When we consolidate indexes from queries we don't support, these indexes are empty as we don't process any field. This doesn't affect the index detection, but when we consolidate indexes, as an empty index is a prefix of any other index, we consider these not supported queries covered. That's misleading, because a MongoDB index can not cover an Atlas Search query.

      Steps to Reproduce

      How could an engineer replicate the issue you’re reporting?

      @Test
      fun `should not cover empty indexes with other indexes`() {
          val index = CollectionIndexConsolidation.apply(
            baseIndex = indexOf("f1" to 1, "f2" to 1) {
                query {
                    findMany("my.coll".toNs()) {
                        filterBy {
                            predicate(Name.EQ) {
                                schema("should_be_covered")
                            }
                        }
                    }
                }
            },
      
            indexes = listOf(indexOf() {
                query {
                    findMany("my.coll".toNs()) {
                        filterBy {
                            predicate(Name.EQ) {
                                schema("should_NOT_be_covered")
                            }
                        }
                    }
                }
            }),
            options = emptyOptions()
          )
      
          assertMongoDbIndexIs(arrayOf("f1" to 1, "f2" to 1), index)
          assertNumberOfCoveredQueriesForIndex(1, index)
      }
      

      Expected Results

      What do you expect to happen?

      Actual Results

      What do you observe is happening?

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.mas@mongodb.com Kevin Mas Ruiz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: