[SERVER-15320] BSONElement does not support a simple encapsulation of the value Created: 18/Sep/14  Updated: 29/Jan/18  Resolved: 09/Jun/17

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.7.6
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Fix Votes: 0
Labels: 28qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Problem:

There are cases when you you simply want to get the encapsulated value (type and object) of a BSONElement so that you can put this value elsewhere.

Workaround:
Use a switch statement to examine the type and then call the appropriate access method to get a String, Number, date etc. before putting this into the target element.



 Comments   
Comment by Mira Carey [ 09/Jun/17 ]

BSONElement::wrap() or wrap(StringData) can serve to wrap up the keyname, type and value, or basically just type and value (for "" key).

I think that's a satisfactory work around

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