I'm generating a json document in C# using the Bson library function ToJson(). The document starts with:
{ "Key" : NumberLong("2053249000001086"), ...
I'm parsing this document in a C++ DLL using the bsoncxx drivers. An exception is thrown by this line: '''bsoncxx::from_json(TheJsonDocument).view()'''
with What = "Got parse error at "u", position 11: "SPECIAL_EXPECTED": could not parse JSON document"
In other words: the NumberLong() tag is not supported. The workaround I currently use is to export a string, and to read it with atoll() in the DLL.
Any better idea ?
The extended json you produced is invalid. The correct spelling is
{"$numberLong": <64-bit signed integer as a string>}
See https://github.com/mongodb/specifications/blob/master/source/extended-json.rst#conversion-table.
You need to fix the producing side to produce correct extended json.