Bson
https://en.wikipedia.org/wiki/BSON
BSON /ˈbiːsɒn/ is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database.
It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB.
The name "BSON" is based on the term JSON and stands for "Binary JSON".
数据类型和语法:
BSON documents (objects) consist of an ordered list of elements.
Each element consists of a field name, a type, and a value. Field names are strings.
Types include:
- string
- integer (32- or 64-bit)
- double (64-bit IEEE 754 floating point number)
- date (integer number of milliseconds since the Unix epoch)
- byte array (binary data)
- boolean (
trueandfalse) - null
- BSON object
- BSON array
- Javascript Code
- MD5 Binary Data
- Regular Expression
BSON types are nominally a superset of JSON types (JSON does not have a date or a byte array type, for example[3]), with one exception of not having a universal "number" type as JSON does.
效率
Compared to JSON, BSON is designed to be efficient both in storage space and scan-speed.
Large elements in a BSON document are prefixed with a length field to facilitate促进 scanning.
In some cases, BSON will use more space than JSON due to the length prefixes and explicit array indices.
范例
A document such as {"hello":"world"} will be stored as:
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')
Bson的更多相关文章
- ASP.NET Web API 2.1支持Binary JSON(Bson)
ASP.NET Web API 2.1内建支持XML.Json.Bson.form-urlencoded的MiME type,今天重点介绍下Bson.BSON是由10gen开发的一个数据格式,目前主要 ...
- MongoDB在Windows下安装、Shell客户端的使用、Bson扩充的数据类型、MongoVUE可视化工具安装和简单使用、Robomongo可视化工具(2)
一.Windows 下载安装 1.去http://www.mongodb.org/downloads下载,mongodb默认安装在C:\Program Files\MongoDB目录下,到F:\Off ...
- BSON 1.0版本规范(翻译)
BSON 1.0版本规范 本文翻译自 http://bsonspec.org/spec.html BSON是用于存储零个或多个键/值对为一个单一的实体的一个二进制格式.我们称这个实体为文档(Docum ...
- nginx安装过程,报错处理:make[1]: *** [objs/addon/src/bson.o] Error 1
nginx安装过程中,经常会有各种错误: 具体安装步骤这里不做说明,网上一搜大把: 主要分析安装过程中遇到的问题 在make编译的时候,若报如下错误: cc1: warnings being trea ...
- MongoDB之bson的介绍
MongoDB之bson的介绍 1. 什么是bson BSON是一种类json的一种二进制形式的存储格式,简称Binary JSON,它和JSON一样,支持内嵌的文档对象和数组对象,但是BSON有JS ...
- MongoDB之一介绍(MongoDB与MySQL的区别、BSON与JSON的区别)
MySQL与MongoDB的操作对比,以及区别 MySQL与MongoDB都是开源的常用数据库,但是MySQL是传统的关系型数据库,MongoDB则是非关系型数据库,也叫文档型数据库,是一种NoSQL ...
- BSON与JSON的区别
BSON是由10gen开发的一个数据格式,目前主要用于MongoDB中,是MongoDB的数据存储格式.BSON基于JSON格式,选择JSON进行改造的原因主要是JSON的通用性及JSON的schem ...
- MongoDB - Introduction to MongoDB, BSON Types
BSON is a binary serialization format used to store documents and make remote procedure calls in Mon ...
- 什么是JSON?如何使用?它比BSON更好吗?
本文由码农网 – 小峰原创翻译,转载请看清文末的转载要求,欢迎参与我们的付费投稿计划! 长话短说:如果你想知道JSON——它是什么,如何使用它以及它和BSON哪个更好,那么你来对地方了.在本文中,我们 ...
随机推荐
- OpenStack 虚拟机监控方案确定
Contents [hide] 1 监控方案调研过程 1.1 1. 虚拟机里内置监控模块 1.2 2. 通过libvirt获取虚拟机数据监控. 2 a.测试openstack的自待组件ceilomet ...
- equals 与 == 的区别和用法(C# & Java)【转】
转至http://www.cnblogs.com/beeone/archive/2011/04/25/2026674.html public class TestString { public sta ...
- Hadoop实战2:MapReduce编程-WordCount实例-streaming-python环境
这是搭建hadoop环境后的第一个MapReduce程序: 基于hadoop streaming的python的脚本: 1 map.py文件,把文本的内容划分成单词: #!/usr/bin/pytho ...
- Xutils请求服务器json数据与下载文件
String code_url = "https://ic.snssdk.com/user/mobile/send_code/v2/"; HttpUtils httpUtils = ...
- Jquery中$(document).ready()与传统JavaScript中的window.onload方法的区别(2016/8/3)
Jquery中$(document).ready()的作用类似于传统JavaScript中的window.onload方法,不过与window.onload方法还是有区别的. 1.执行时间 ...
- Java中的TreeMap、Comparable、Comparator
我们知道HashMap的存储位置是按照key这个对象的hashCode来存放的,而TreeMap则是不是按照hashCode来存放,他是按照实现的Comparable接口的compareTo这个方法来 ...
- win7中搜索文件内容的方法
打开“控制面板”,选择“大类别”或“小类别”,然后打开 “索引选项”.点击“高级”按钮,在弹出的对话框中打开“文件类型”标签,在下方的输入框中“将新扩展名添加到列表中”,添加要搜索的未知文本文件的扩展 ...
- CSS 学习质料
1.学习CSS布局 http://zh.learnlayout.com/display.html
- c# UDP
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Convert.ChangeType转换泛型的性能损失测试
经常要传入参数包,当时一直是用泛型+ChangeType解决的.测试了下,看来这样确实慢了. 另外,可能都会认为Release发布之后会被优化掉.但测试了Release和Debug结果一样慢,比较失望 ...