I'm just learning MongoDB but I'm a bit puzzled about the data format accepted by MongoDB. So I understand that by definition:
"MongoDB doesn’t actually use JSON to store the data; rather, it uses an open data format developed by the MongoDB team called BSON"
That's clear, however I have just learnt that you can actually import a JSON document into mongodb. So is it correct to say that you can use JSON format to insert data into MongoDB but data internally is arranged into BSON for performance reasons ? Hope that somebody can shed some light on it.
Yes, that is correct. MongoDB uses BSON to increase performance. See http://docs.mongodb.org/manual/core/document/.
There are various drivers that make it easy to work with MongoDB. In most cases you dont have to worry about BSON, since it is handled for you.
Not really for "performance".
BSON is an explanative version of JSON which allows the storage and manipulation of objects such as ISODate
and OjbectId
. It allows for MongoDB to produe a syntax and object rich document beyond what JSON can.
BSON normally takes more space than JSON due to its object usage and what not as such there is no serious performance gain. It is about the descriptive objects that can be used and sored with the document.
MongoDB communicates entirely in BSON, including query results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With