[SERVER-5209] can't compare values of BSON types 16 and 18 Created: 05/Mar/12 Updated: 05/Nov/15 Resolved: 07/Mar/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Internal Code |
| Affects Version/s: | 2.1.0 |
| Fix Version/s: | 2.1.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tim Garvin | Assignee: | Chris Westin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Debian 5, Kernel 2.6.26, 32-bit OS. |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | Linux | ||||||||
| Participants: | |||||||||
| Description |
|
When testing the aggregation framework, tried to group by a field that has been previously stored as both 64-bit and 32-bit numbers, depending on the number. Running the aggregation query results in a code 16016, or "exception: can't compare values of BSON types 16 and 18" Running the old db.collection.group query still works as intended. Heavily simplified versions of the aggregation framework query (not working) and the original collection.group query (working) are attached. In both of these queries, it is understood that the field 'ip1' may contain either a 32-bit number (BSON type 16) or a 64-bit number (type 18) I would expect both queries to return groupings based on the field 'ip1'. A probable work-around (implementing this currently) is to somehow ensure that all data is written as a 64-bit number, so that all comparisons are between like types, but this seems like something that a green mongo user might find cumbersome to have to understand and deal with. New to the bug-fix cycle, and to mongodb in general-- let me know if there's more information I can provide. |
| Comments |
| Comment by Chris Westin [ 07/Mar/12 ] |
|
$sort may also be affected, since the numeric comparisons have been adjusted to work across numeric data types. |
| Comment by Sam Kleinman (Inactive) [ 07/Mar/12 ] |
|
does this only affect the $group operator, or are other pipeline operators similarly impacted? |
| Comment by Chris Westin [ 07/Mar/12 ] |
|
BSON allows the use of several numeric types, not just JavaScript's Aggregation (as well as any other operations that operate over an entire The fix adds code so that those values are all treated as being the same. |
| Comment by Sam Kleinman (Inactive) [ 07/Mar/12 ] |
|
Could you illuminate the documentation change that you think is required? It seems like the previous behavior wasn't documented, but perhaps I'm missing something. |
| Comment by auto [ 07/Mar/12 ] |
|
Author: {u'login': u'cwestin', u'name': u'U-tellus\\cwestin', u'email': u'cwestin@10gen.com'}Message: |