knowledge/technology/files/BSON.md
2024-01-17 09:00:45 +01:00

1.2 KiB
Raw Blame History

obj website wiki
concept https://bsonspec.org https://en.wikipedia.org/wiki/BSON

BSON

BSON, short for Bin­ary JSON, is a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. Like JSON, BSON sup­ports the em­bed­ding of doc­u­ments and ar­rays with­in oth­er doc­u­ments and ar­rays. BSON also con­tains ex­ten­sions that al­low rep­res­ent­a­tion of data types that are not part of the JSON spec. For ex­ample, BSON has a Date type and a BinData type. MongoDB uses BSON internally for storing the database.

BSON was de­signed to have the fol­low­ing three char­ac­ter­ist­ics:

  • Lightweight: Keep­ing spa­tial over­head to a min­im­um is im­port­ant for any data rep­res­ent­a­tion format, es­pe­cially when used over the net­work.
  • Traversable: BSON is de­signed to be tra­versed eas­ily. This is a vi­tal prop­erty in its role as the primary data rep­res­ent­a­tion for Mon­goDB.
  • Efficient: En­cod­ing data to BSON and de­cod­ing from BSON can be per­formed very quickly in most lan­guages due to the use of C data types.