[JAVA-392] java.lang.Character could be encoded as a BSON string Created: 04/Jul/11  Updated: 18/Jun/12  Resolved: 14/Nov/11

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.7
Fix Version/s: 2.8.0

Type: Improvement Priority: Minor - P4
Reporter: Thilo Planz Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: bson
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Putting a Character into a BSONObject will result in "json can't serialize type : class java.lang.Character".

The easy workaround is to use a String instead of Character.
However, the BSON encoder could be doing this lossless conversion automatically, and encode a Java character as a BSON one-character string. This would be in line with how both arrays and lists are accepted for BSON arrays.
Of course, decoding this data would return a String.



 Comments   
Comment by Jeffrey Yemin [ 18/Jun/12 ]

Closing for 2.8.0 release.

Comment by auto [ 14/Nov/11 ]

Author:

{u'login': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: JAVA-392: Character -> String encoding
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/ea25e39f1560948a3144a2a9701987debde82340

Generated at Thu Feb 08 08:52:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.