BSON
BSONは主にMongoDBのデータストレージ及びネットワーク転送フォーマットとして利用されている、データ交換フォーマッ�…
|
| |
| 拡張子 | .bson |
|---|---|
| MIMEタイプ | none[1] |
| 種別 | データ交換 |
| 派生元 | JSON |
| 国際標準 | no RFC yet |
| ウェブサイト |
bsonspec |
BSONは主にMongoDBのデータストレージ及びネットワーク転送フォーマットとして利用されている、データ交換フォーマットである。 単純なデータ構造や連想配列(MongoDBではオブジェクトまたはドキュメントと表す)を示すバイナリ構造であり、 名称はJSON由来であり、「バイナリ型JSON」の略語である[2]。
データ型と構文
フィールド名、型、値の要素順の構造である、型はstring、integer (32ビットまたは64ビット)、double(64ビットのIEEE 754)、date(UNIX時間の1 E-3 s単位整数)、byte array(バイナリデータ配列)、boolean(trueまたはfalse)、null、BSONオブジェクト、BSON配列、正規表現、JavaScriptコードのいずれかである。
型は名目上JSONの上位集合であるが(例えばJSONは「date」と「byte array」を持たない[3])、例外としてJSONが使用可能な「number」が使用できない。
効率
JSONに比べて、ストレージ容量及びスキャン速度に効率的な設計である。 大容量のデータのスキャンを容易にするため、データ長部が扱われる。 データのプレフィックス長や配列指数によっては、JSONよりも多くの容量を占めることもある[2]。
例
例文{"hello":"world"} は以下のように格納される:
Bson:
\x16\x00\x00\x00 // total document size
\x02 // 0x02 = type String
hello\x00 // field name
\x06\x00\x00\x00world\x00 // field value (size of value, value, null terminator)
\x00 // 0x00 = type EOO ('end of object')
関連項目
脚注
外部リンク
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.