当前位置:网站首页>Difference between JSON and bson
Difference between JSON and bson
2022-07-03 16:34:00 【The clouds are idle】
BSON
BSON By 10gen Developed a data format , At present, it is mainly used for MongoDB in , yes MongoDB Data storage format .BSON be based on JSON Format , choice JSON The main reason for the transformation is JSON The generality of and JSON Of schemaless Characteristics of .
By definition :
BSON( Binary Serialized Document Format) Is a binary storage format , Similar to C The name of the language structure 、 For the representation , Support embedded document objects and array objects , Lightweight 、 Ergodicity 、 Characteristics of efficiency , It can effectively describe unstructured data and structured data .
BSON Is a kind JSON A storage format in binary form , abbreviation Binary JSON, It and JSON equally , Support embedded document objects and array objects , however BSON Yes JSON There are no data types , Such as Date and BinData type .
BSON It can be used as a storage form of network data exchange , This is a bit like Google Of Protocol Buffer, however BSON It's a kind of schema-less Storage form of , Its advantage is high flexibility , But its disadvantage is that the space utilization is not ideal .
in general :
BSON There are three characteristics : Lightweight 、 Ergodicity 、 Efficiency .
JSON
JSON yes JavaScript Object Notation An acronym for , The word means javascript Object notation , here json It means something similar to javascript A data format for an object .
Use JSON The format and parsing of can easily represent an object information ,json There are two formats :① Object format :{“key1”:obj,“key2”:obj,“key3”:obj…}、② Array / Set format :[obj,obj,obj…].
1. Faster traversal speed
Yes json Format , Too big json Structure can cause data traversal to be very slow . stay json in , To skip a document for data reading , This document needs to be scanned , The need for cumbersome data structure matching , For example, the matching of parentheses .
and BSON Yes json A big improvement of , It will be json The length of each element of exists in the head of the element , In this way, you only need to read the length of the element, and then you can seek Read at the specified point .
2. It's easier to operate
Yes JSON Come on , There is no type of data storage , For example, you need to modify the basic value , from 9 To 10, From one character to two , So maybe all the content behind it needs to be moved back one bit .
While using BSON, You can specify this column as a number column , So no matter the number from 9 Grow to 10 still 100, We're all just making changes on the one where the numbers are stored , It will not cause the total length of data to increase .
Of course , stay mongoDB in , If the number increases from plastic to long , The total length of data will increase .
3. Added additional data types
JSON Is a very convenient data exchange format , But its types are limited .
BSON On the basis of it, we add “byte array” data type . This eliminates the need for binary storage base64 After conversion, it will be saved as JSON, It greatly reduces the computation cost and data size .
Of course , Sometimes ,BSON relative JSON There is no advantage in space , For example, yes. {“field”:7}, stay JSON On the storage of 7 Only one byte is used , And if used BSON, That is at least 4 Bytes (32 position )
Currently in 10gen Under the efforts of ,BSON There are encoding and decoding packages for many languages . And are Apache 2 license Next open source . And still with mongoDB Further development .
边栏推荐
- [statement] about searching sogk1997 and finding many web crawler results
- 2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
- Mb10m-asemi rectifier bridge mb10m
- 记一次jar包冲突解决过程
- 特征多项式与常系数齐次线性递推
- Record a jar package conflict resolution process
- QT串口ui设计和解决显示中文乱码
- Golang 匿名函数使用
- 香港理工大学|数据高效的强化学习和网络流量动态的自适应最优周界控制
- ThreeJS 第二篇:顶点概念、几何体结构
猜你喜欢

Aike AI frontier promotion (7.3)

Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer

IDEA-配置插件

Cocos Creator 2.x 自动打包(构建 + 编译)

Multithread 02 thread join

TCP擁塞控制詳解 | 3. 設計空間

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

Visual SLAM algorithms: a survey from 2010 to 2016

Explore Cassandra's decentralized distributed architecture

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
随机推荐
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
Unreal_ Datatable implements ID self increment and sets rowname
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
消息队列消息丢失和消息重复发送的处理策略
Netease UI automation test exploration: airtest+poco
Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
nifi从入门到实战(保姆级教程)——flow
Client does not support authentication protocol requested by server; consider upgrading MySQL client
在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them
【剑指 Offer 】64. 求1+2+…+n
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
[combinatorics] combinatorial identity (sum of combinatorial identity products 1 | sum of products 1 proof | sum of combinatorial identity products 2 | sum of products 2 proof)
Construction practice camp - graduation summary of phase 6
深入理解 SQL 中的 Grouping Sets 语句
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
相同切入点的抽取
Mongodb installation and basic operation
Hibernate的缓存机制/会话级缓存机制