BSON - JSON serialization and deserialization

91 views
Skip to first unread message

David Glavas

unread,
Jan 28, 2020, 10:00:02 AM1/28/20
to BSON
Can someone briefly explain what happens when converting a plaintext JSON document to a BSON document (and vice versa: BSON to plaintext JSON) using the tojson() and fromjson() functions in MongoDB?

For example, does any sorting of the key-value pairs in objects happen? Does the order of values change in any way? Is everything done in one pass? Are the functions slower/faster for certain documents (eg. arrays vs objects, slower/faster for certain data types, deeper vs longer documents)? What are the most expensive operations? Does someone know the time and space complexities (big O) of these two functions?

How would you describe how the tojson() and fromjson() functions work?


Reply all
Reply to author
Forward
0 new messages