@@ -13,11 +13,75 @@ Document Data Format: BSON
13
13
Overview
14
14
--------
15
15
16
- - Definition of BSON format, where it's used, why it's used.
17
- - Link to more info on BSON
18
- - What information you can find in the following sections
16
+ This guide explains the BSON data format, how MongoDB uses it, and how to
17
+ install the BSON library independently of the MongoDB driver.
19
18
20
- Installation
21
- ------------
19
+ BSON Data Format
20
+ ----------------
22
21
23
- - Instructions on how to add the dependency with Maven or Gradle
22
+ **BSON**, or Binary JSON, is the data format that MongoDB uses to organize
23
+ and store data. This data format includes all JSON data structure types and
24
+ adds support for types including dates, different size integers, ObjectIds, and
25
+ binary data. For a complete list of supported types, see the
26
+ :manual:`BSON Types </reference/bson-types>` server manual page.
27
+
28
+ The binary format is not human-readable, but you can use the
29
+ :ref:`Java BSON library <install-bson-library>` to convert it to a JSON
30
+ representation. You can read more about the relationship between these
31
+ formats in our article on :website:`JSON and BSON </json-and-bson>`.
32
+
33
+ MongoDB and BSON
34
+ ----------------
35
+
36
+ The MongoDB Java Driver, which uses the BSON library, allows you to work
37
+ with BSON data by using one of the object types that implement the
38
+ :java-docs:`Bson <apidocs/bson/org/bson/conversions/Bson.html>` interface,
39
+ including:
40
+
41
+ - :java-docs:`Document <apidocs/bson/org/bson/Document.html>` (BSON library package)
42
+ - :java-docs:`BsonDocument <apidocs/bson/org/bson/BsonDocument.html>` (BSON library package)
43
+ - :java-docs:`RawBsonDocument <apidocs/bson/org/bson/RawBsonDocument.html>` (BSON library package)
44
+ - :java-docs:`BasicDBObject <apidocs/mongodb-driver-core/com/mongodb/BasicDBObject.html>` (Java Driver package)
45
+
46
+ For more information on using these object types, see our
47
+ :doc:`Documents guide <fundamentals/data-formats/documents>`.
48
+
49
+ .. _install-bson-library:
50
+
51
+ Install the BSON Library
52
+ ------------------------
53
+
54
+ These instructions show you how to add the BSON library as a dependency to
55
+ your project. If you added the MongoDB Java driver as a dependency to your
56
+ project, you can skip this step since the BSON library is already included
57
+ as a required dependency of the driver. For instructions on how to add the
58
+ MongoDB driver as a dependency to your project, see the
59
+ :ref:`driver installation <add-mongodb-dependency>` section of our Quick Start
60
+ guide.
61
+
62
+ We recommend that you use the `Maven <https://maven.apache.org/>`__ or
63
+ `Gradle <https://gradle.org/>`__ build automation tool to manage your project
64
+ dependencies. Select from the tabs below to see the dependency declaration
65
+ for that tool:
66
+
67
+ .. tabs::
68
+
69
+ .. tab:: Maven
70
+ :tabid: maven-dependencies
71
+
72
+ The following snippet shows the dependency declaration in the
73
+ ``dependencies`` section of your ``pom.xml`` file.
74
+
75
+ .. include:: /includes/fundamentals/code-snippets/bson-maven-versioned.rst
76
+
77
+ .. tab:: Gradle
78
+ :tabid: gradle-dependencies
79
+
80
+ The following snippet shows the dependency declaration in the
81
+ ``dependencies`` object in your ``build.gradle`` file.
82
+
83
+ .. include:: /includes/fundamentals/code-snippets/bson-gradle-versioned.rst
84
+
85
+ If you are not using one of the tools listed above, you can include it in
86
+ your project by downloading the JAR file directly from the
87
+ `sonatype repository <https://repo1.maven.org/maven2/org/mongodb/bson/>`__.
0 commit comments