BSON
Encyclopedia
BSON is a computer
Computer
A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...

 data interchange format used mainly as a data storage and network transfer format in the MongoDB
MongoDB
MongoDB is an open source, high-performance, schema-free, document-oriented database written in the C++ programming language...

 database. It is a binary form for representing simple data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

s and associative array
Associative array
In computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....

s (called objects or documents in MongoDB). The name "BSON" is based on the term JSON
JSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...

 and stands for "Binary JSON".BSON Specification

Data types and syntax

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
    Boolean datatype
    In computer science, the Boolean or logical data type is a data type, having two values , intended to represent the truth values of logic and Boolean algebra...

     (true and false)
  • null
  • BSON object
  • BSON array
  • regular expression
    Regular expression
    In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

  • JavaScript
    JavaScript
    JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

     code


BSON types are nominally a superset of JSON
JSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...

 types (JSON does not have a date or a byte array type, for example), with one exception of not having a universal "number" type, but because of length limitations, some valid JSON values (such as very long strings, very large numbers, or numbers with too many decimal places) are not valid BSON values.

Efficiency

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.

See also

  • JSON
    JSON
    JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...

  • Protocol Buffers
    Protocol Buffers
    Protocol Buffers are a serialization format with an interface description language developed by Google. The original Google implementation for C++, Java and Python is available under a free software, open source license....

  • Action Message Format
    Action Message Format
    Action Message Format is a binary format used to serialize objects graphs such ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives....

  • Apache Thrift
  • MessagePack
    MessagePack
    MessagePack is a computer data interchange format. It is a binary form for representing simple data structure like arrays and associative arrays. MessagePack aims to be as compact and simple as possible...

  • Document-oriented database
    Document-oriented database
    A document-oriented database is a computer program designed for storing, retrieving, and managing document-oriented, or semi structured data, information...

  • Abstract Syntax Notation One
    Abstract Syntax Notation One
    Data generated at various sources of observation need to be transmitted to one or more locations that process it to generate useful results. For example, voluminous signal data collected by a radio telescope from outer space. The system recording the data and the system processing it later may be...

    (ASN.1)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK