[SERVER-30773] bsonWoCompare and bsonBinaryEqual should work with bsonelement types Created: 22/Aug/17 Updated: 30/Oct/23 Resolved: 04/Oct/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.4, 4.1.5 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Mira Carey | Assignee: | Annie Black |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | service_architecture | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Backport Requested: |
v4.0
|
||||||||||||||||
| Sprint: | Service Arch 2018-10-08 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 42 | ||||||||||||||||
| Description |
|
bsonWoCompare and bsonBinaryEqual check to see if their arguments are objects (which they are for our exposed bson types), before converting them to bson and then dispatching to underlying bson methods. This inappropriately shows any special two non-top-level bson values as equal (without throwing) as they convert as general objects (with no actual fields). For some objects, like timestamp, this works (as they store their state as js visible fields). For others, like numberlong or bindata, it does not. It appears that we have instances of both patterns in current jstests, so it may be advantageous to check for the bson element types, and wrap the objects in that case. If we don't want to make them work correctly, we should at least throw for broken types |
| Comments |
| Comment by Githook User [ 19/Oct/18 ] | ||
|
Author: {'name': 'ablack12', 'email': 'annie.black@10gen.com', 'username': 'ablack12'}Message: (cherry picked from commit 2d379ce39872fdfc04e6775ed8adea7ccdd1d1c1) | ||
| Comment by Githook User [ 02/Oct/18 ] | ||
|
Author: {'name': 'ablack12', 'email': 'annie.black@10gen.com', 'username': 'ablack12'}Message: | ||
| Comment by Annie Black [ 02/Oct/18 ] | ||
| Comment by Githook User [ 26/Sep/18 ] | ||
|
Author: {'name': 'ablack12', 'email': 'annie.black@10gen.com', 'username': 'ablack12'}Message: | ||
| Comment by Kyle Suarez [ 30/Jan/18 ] | ||
|
This would be very helpful when writing tests. For example, I often execute queries with a sort and then make an assertion on the final sort order, which makes me resort to hacks like
|