How could I use covered query with null value ?

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I have a collection with 2 documents such as:

      • {_id: 1, test: 1}
      • {_id: 2, test: null}

      On this collection, I have 1 index such as:

      • {test: 1}

      Explain a query tell me that :

      • query on {test: 1}

        is a covered query.

      • query on {test: null}

        is not.

      How could I use a covered query in this specific case to use my index without needing to scan the collection ?

      Thanks.

            Assignee:
            Unassigned
            Reporter:
            Benjamin Appréderisse
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: