[SERVER-4529] fast count mode should not be used when matching against null Created: 19/Dec/11 Updated: 11/Jul/16 Resolved: 24/Oct/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 2.3.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aaron Staple | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
There are some cases where null keys are generated even though a general query should not match null, specifically so that Because of these null keys, the fast count optimization should be prevented when matching against null. Test forthcoming. Background Index Key Extraction In many cases, indexing a nested field within an array uses an existing value from the document. Eg for index { 'a.b':1 }
If the nested field is missing however, a null value is stored in the index
In the case where some array values have an 'a.b' field and some do not, a mixture of null and non null index keys is produced:
Query Matching Semantics For a simple query, a request for null will match missing values only if there are no non missing values for the key. But a request for null will always match an explicit null value. For query
However, the $elemMatch operator will restrict matching to individual array elements. If a single array element has a missing 'b', the document will match null. For query
This behavior was requested in |
| Comments |
| Comment by auto [ 24/Oct/12 ] |
|
Author: {u'date': u'2012-10-14T20:48:04-07:00', u'email': u'aaron@10gen.com', u'name': u'Aaron'}Message: |
| Comment by auto [ 19/Dec/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |