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哪个更好,那么你来对地方了.在本文中,我们 ...
随机推荐
- centos的用户管理相关命令所在的包
用户管理命令是指:useradd userdel groupadd groupdel 这些 这些命令出自一个叫 shadow-utils 的包. 对于配置文件 /etc/shadow ,则来自一个叫 ...
- 由ccf第一题引出的问题
当时的情况是这样的,代码中需要用到一个较大的二维数组,但只要定义这个大二维数组编译就出错,无奈后来用malloc自己实现了类似二维数组的操作. 其中的b数组设为全局的或者静态的也都可以解决overfl ...
- 怎么学习C++?
一个学习十年c++的建议如下: 其实学习C++的读书顺序应该是这样的(对于有C基础的朋友): C++ Primer Effective C++ Exceptional C++ Inside the C ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON TestObjDef
zw版[转发·台湾nvp系列Delphi例程]HALCON TestObjDef procedure TForm1.Button1Click(Sender: TObject);var img : HU ...
- OpenStack collectd的从零安装服务端
安装collectd包操作同客户端相同,不在赘述 配置文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 ...
- After install XAMPP
1. configure mysql and phpmyadmin 1.1 mysql $ /Applications/XAMPP/xamppfiles/bin/mysql -uroot $ mysq ...
- printf,sprintf,vsprintf 区别【转】
转自:http://blog.csdn.net/anye3000/article/details/6593551 有C语言写作历史的程序员往往特别喜欢printf 函数.即使可以使用更简单的命令(例如 ...
- Java URLClassLoader和ClassLoader
开始:看名字都带有ClassLoader,叫做类加载器,事实上是可以理解为动态的加载类,不过,也不是只能加载类,也可以加载其他形式的文件,比如说.properties属性文件. 区别:其实在两个类加载 ...
- iOS 处理多个网络请求的并发的情况
如何处理多个网络请求的并发的情况 一.概念 1.并发 当有多个线程在操作时,如果系统只有一个CPU,则它根本不可能真正同时进行一个以上的线程,它只能把CPU运行时间划分成若干个时间段,再将时间 段分配 ...
- js获取事件源
js获取事件源: 1. event.srcElement.nodeName //获取事件源对象,但是火狐不支持event 2.