当前位置:网站首页>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 .
边栏推荐
- [web security] - [SQL injection] - error detection injection
- 一台服务器最大并发 tcp 连接数多少?65535?
- Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
- Is it safe to open a stock account by mobile registration? Does it need money to open an account
- 0214-27100 a day with little fluctuation
- Characteristic polynomial and constant coefficient homogeneous linear recurrence
- 手机注册股票开户安全吗 开户需要钱吗
- [statement] about searching sogk1997 and finding many web crawler results
- PHP CI(CodeIgniter)log级别设置
- PHP中register_globals参数设置
猜你喜欢

TCP congestion control details | 3 design space

Mixlab编辑团队招募队友啦~~

There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them

Data driving of appium framework for mobile terminal automated testing

Deep understanding of grouping sets statements in SQL

Initial test of scikit learn Library

Add color to the interface automation test framework and realize the enterprise wechat test report

NSQ source code installation and operation process

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)

【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
随机推荐
疫情常态化大背景下,关于远程办公的思考|社区征文
相同切入点的抽取
Hibernate的缓存机制/会话级缓存机制
MySQL converts comma separated attribute field data from column to row
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
PHP CI (CodeIgniter) log level setting
Aike AI frontier promotion (7.3)
Cocos Creator 2. X automatic packaging (build + compile)
用同花顺炒股开户安全吗?
nifi从入门到实战(保姆级教程)——flow
Netease UI automation test exploration: airtest+poco
Record windows10 installation tensorflow-gpu2.4.0
一台服务器最大并发 tcp 连接数多少?65535?
AcWing 第58 场周赛
程序猿如何快速成长
Pointcut expression
Learn from me about the enterprise flutter project: simplified framework demo reference
QT串口ui设计和解决显示中文乱码
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日