[SERVER-21908] How could I use covered query with null value ? Created: 15/Dec/15  Updated: 15/Dec/15  Resolved: 15/Dec/15

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Minor - P4
Reporter: Benjamin Appréderisse Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

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.



 Comments   
Comment by Kelsey Schubert [ 15/Dec/15 ]

Hi bappr,

Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group.

Thank you,
Thomas

Generated at Thu Feb 08 03:58:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.