Updates the mongo-style raw encoding to match v2 of the Extended JSON spec#247
Updates the mongo-style raw encoding to match v2 of the Extended JSON spec#247atheriel wants to merge 1 commit intojeroen:masterfrom atheriel:mongo-raw-changes
Conversation
The "$binary" format has changed as of May 2017. Before, we had e.g.
{"x" : {"$binary" : "//8=", "$type" : "00"}}
and now we have e.g.
{"x" : { "$binary" : {"base64" : "//8=", "subType" : "00"}}}
Signed-off-by: Aaron Jacobs <aaron.jacobs@crescendotechnology.com>
|
Looking at the reference manual it still describes the current format: |
|
Well, I didn't expect that. |
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
=======================================
Coverage 63.82% 63.82%
=======================================
Files 88 88
Lines 2764 2764
=======================================
Hits 1764 1764
Misses 1000 1000
Continue to review full report at Codecov.
|
|
The Q&A section of the spec suggests that implementations could support both (it terms the older version "Legacy"). Perhaps we could have a |
|
Why do you need this new format? I would much prefer to stick with the mongo default behavior. |
|
I am running mongodb 4.0 and get this: m <- mongolite::mongo()
m$insert(list(foo=charToRaw('bar')))
m$export()So if neither the documentation nor the implementation of mongodb has changed, I don't think jsonlite should either. |
|
I don't need it -- and certainly don't mind holding off on changing it. I only noticed the issue when I tried to run the As for your example, I noticed that Finally, there appears to be an open issue to update the mongodb docs, which clears up some of the mystery. |
|
OK thanks for the clarification. I think I should first aks clarification from the mongo devs if I should be switching to |
|
Sounds reasonable to me! |

The
$binaryformat has changed as of May 2017 (see commit). Before, we had{"x" : {"$binary" : "//8=", "$type" : "00"}}and now we have
{"x" : { "$binary" : {"base64" : "//8=", "subType" : "00"}}}This commit should implement the new format. I believe this may be a breaking change for some users, but since they are likely interacting with MongoDB in some way they'll have to change at some point anyway.