[JAVA-2140] Add support for Decimal128 BSON type Created: 07/Mar/16 Updated: 27/May/22 Resolved: 18/Jul/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Rathi Gnanasekaran | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Epic Link: | MongoDB 3.4 for Java driver | ||||||||||||
| Server Compat: | 3.3 | ||||||||||||
| Description |
|
Add driver support for a new BSON type for decimal numbers, which will be added to MongoDB in version 3.4. This type will use the decimal128 format as defined by the IEEE 754 standard and support up to 34 decimal digits and a range from -9.999999999999999999999999999999999×10^6144 to +9.999999999999999999999999999999999×10^6144. It also supports positive and negative zero, positive and negative infinity, and two forms of NaN (regular and signaled). Decimal values will be treated like any other numeric type, and compare and sort correctly with other types based on actual numeric value. Operations on decimals are implemented in accordance with the standard, so a value of 0.10 will retain its trailing zeros while comparing equal to 0.1, 0.10000 etc. |
| Comments |
| Comment by Raviteja [ 09/Jan/17 ] | |||||||||||
|
I was actually transforming RDMS to Mongo over a custom code. Reading data over JDBC and creating a JSON map using JsonBuilder and then doing a
To workaround this issue I did this, FYI:
I don't want to go over each element and convert it. | |||||||||||
| Comment by Jeffrey Yemin [ 09/Jan/17 ] | |||||||||||
|
It seems like you're doing something like this:
If so, the driver doesn't support encoding a BigDecimal directly to Decimal128. You can do this instead:
| |||||||||||
| Comment by Raviteja [ 09/Jan/17 ] | |||||||||||
|
@jeff.yemin I get the following stacktrace when using the driver version 3.4.1, is this related?
| |||||||||||
| Comment by Githook User [ 06/Sep/16 ] | |||||||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: | |||||||||||
| Comment by Githook User [ 18/Jul/16 ] | |||||||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: | |||||||||||
| Comment by Githook User [ 26/Apr/16 ] | |||||||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: | |||||||||||
| Comment by Githook User [ 26/Apr/16 ] | |||||||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: | |||||||||||
| Comment by Jeffrey Yemin [ 13/Apr/16 ] | |||||||||||
|
Quick tours for new and legacy APIs: |