[SERVER-42664] Add function to mongo shell for converting BSONObj to Array Created: 07/Aug/19 Updated: 29/Oct/23 Resolved: 09/Aug/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | 4.3.1 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Max Hirschhorn | Assignee: | Claire Childs (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Sprint: | STM 2019-08-12, STM 2019-08-26 | ||||
| Participants: | |||||
| Story Points: | 2 | ||||
| Description |
|
The purpose of this function is to make it possible to convert the object
for sort keys returned by compound sort specifications into the array
which can be meaningfully interacted with via JavaScript. The duplicate empty string field names in the object form are otherwise hidden by the first one. It should be possible to use this function on Objects which have non-duplicate and non-empty field names as well. In those cases, it can be thought of as a function similar to Object.values() but one that actually works for BSONInfo instances. We can model this function off the bsonWoCompare() and bsonBinaryEqual() functions where the mongo shell will define a bsonObjToArray() global function that uses ObjectWrapper::toBSON() to convert/extract the argument as a BSONObj. It should then use ValueReader::fromBSONArray() to convert the BSONObj into a JavaScript Array. |
| Comments |
| Comment by Githook User [ 16/Aug/19 ] |
|
Author: {'username': 'chasinglogic', 'email': 'chasinglogic@gmail.com', 'name': 'Mathew Robinson'}Message: |
| Comment by Githook User [ 09/Aug/19 ] |
|
Author: {'name': 'cchilds1', 'username': 'cchilds1', 'email': 'cchilds1@binghamton.edu'}Message: |