当前位置:网站首页>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 .
边栏推荐
- 【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
- QT serial port UI design and solution to display Chinese garbled code
- Uploads labs range (with source code analysis) (under update)
- NSQ source code installation and operation process
- There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them
- 【LeetCode】94. Middle order traversal of binary tree
- Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
- PHP CI(CodeIgniter)log级别设置
- [statement] about searching sogk1997 and finding many web crawler results
- Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
猜你喜欢
Unreal_ Datatable implements ID self increment and sets rowname
Unreal_DataTable 实现Id自增与设置RowName
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
QT串口ui设计和解决显示中文乱码
Netease UI automation test exploration: airtest+poco
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
记一次jar包冲突解决过程
Aike AI frontier promotion (7.3)
A survey of state of the art on visual slam
随机推荐
切入点表达式
8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
用通达信炒股开户安全吗?
Record a jar package conflict resolution process
[combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
PHP secondary domain name session sharing scheme
ThreeJS 第二篇:顶点概念、几何体结构
Extraction of the same pointcut
【剑指 Offer】58 - II. 左旋转字符串
nifi从入门到实战(保姆级教程)——flow
MySQL converts comma separated attribute field data from column to row
架构实战营 - 第 6 期 毕业总结
[combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
Record windows10 installation tensorflow-gpu2.4.0
Caching mechanism of Hibernate / session level caching mechanism
QT serial port UI design and solution to display Chinese garbled code
Unreal_ Datatable implements ID self increment and sets rowname
Nifi from introduction to practice (nanny level tutorial) - flow