Skip to content

Commit ce9663d

Browse files
committed
DOCPS-41150: Specialized Data Formats + BSON
1 parent 6dda8ff commit ce9663d

File tree

6 files changed

+156
-1
lines changed

6 files changed

+156
-1
lines changed

snooty.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ toc_landing_pages = [
1111
"/connect",
1212
"/indexes",
1313
"work-with-indexes",
14+
"/data-formats"
1415
]
1516

1617
sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
@@ -21,7 +22,7 @@ driver-short = "Kotlin Sync driver"
2122
language = "Kotlin"
2223
version-number = "5.1"
2324
version = "v{+version-number+}"
24-
patch-version-number = "{+version-number+}.0"
25+
patch-version-number = "{+version-number+}.2"
2526
mdb-server = "MongoDB Server"
2627
stable-api = "Stable API"
2728
api = "https://mongodb.github.io/mongo-java-driver/{+version-number+}/apidocs/mongodb-driver-kotlin-sync"

source/data-formats.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. _kotlin-sync-data-formats:
2+
3+
========================
4+
Specialized Data Formats
5+
========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
.. facet::
14+
:name: genre
15+
:values: reference
16+
17+
.. meta::
18+
:keywords: bson, data, class, date, time
19+
20+
.. toctree::
21+
:titlesonly:
22+
:maxdepth: 1
23+
24+
/data-formats/bson
25+
26+
.. TODO: /data-formats/data-class
27+
.. TODO: /data-formats/extended-json
28+
.. TODO: /data-formats/time-series
29+
30+
Overview
31+
--------
32+
33+
You can use several types of specialized data formats in your {+driver-short+}
34+
application. To learn how to work with these data formats, see the following
35+
sections:
36+
37+
- Learn how to work with the BSON data format in the :ref:`kotlin-sync-bson` guide.
38+
39+
.. TODO: Uncomment these as pages get built
40+
.. - Learn how to store and retrieve data using {+language+} data classes in the :ref:`data-classes` guide.
41+
.. - Learn how to use the Extended JSON format in the :ref:`kotlin-sync-extended-json` guide.
42+
.. - Learn how to store and interact with time series data in the :ref:`kotlin-sync-time-series` guide.

source/data-formats/bson.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
.. _kotlin-sync-bson:
2+
3+
==========================
4+
Document Data Format: BSON
5+
==========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
Overview
14+
--------
15+
16+
In this guide, you can learn about the BSON data format, how MongoDB
17+
uses it, and how to install the BSON library independently of the
18+
{+driver-short+}.
19+
20+
BSON Data Format
21+
----------------
22+
23+
**BSON**, or Binary JSON, is the data format that MongoDB uses to organize
24+
and store data. This data format includes all JSON data structure types and
25+
adds support for types including dates, differently-sized integers, ObjectIds, and
26+
binary data. For a complete list of supported types, see the
27+
:manual:`BSON Types </reference/bson-types>` server manual page.
28+
29+
The binary format is not human-readable, but you can use the
30+
:ref:`BSON library <install-bson-library>` to convert it to the human-readable JSON
31+
representation. You can read more about the relationship between these
32+
formats in the :website:`JSON and BSON </json-and-bson>` guide on the MongoDB website.
33+
34+
MongoDB and BSON
35+
----------------
36+
37+
You can use BSON data with your {+driver-short+} application by using one of the
38+
following object types that implements the `BSON interface <{+api+}/apidocs/bson/org/bson/conversions/Bson.html>`__:
39+
40+
- `Document <{+api+}/apidocs/bson/org/bson/Document.html>`__ (BSON library package)
41+
- `BsonDocument <{+api+}/apidocs/bson/org/bson/BsonDocument.html>`__ (BSON library package)
42+
- `RawBsonDocument <{+api+}/apidocs/bson/org/bson/RawBsonDocument.html>`__ (BSON library package)
43+
- `JsonObject <{+api+}/apidocs/bson/org/bson/json/JsonObject.html>`__ (BSON library package)
44+
45+
.. _install-bson-library:
46+
47+
Install the BSON Library
48+
------------------------
49+
50+
These instructions detail how to add the BSON library as a dependency to
51+
your project. If you added the MongoDB Kotlin driver as a dependency to your
52+
project, you can skip this step since the BSON library is already included
53+
as a required dependency of the driver.
54+
55+
.. TODO: For instructions on how to add the
56+
.. MongoDB Kotlin driver as a dependency to your project, see the
57+
.. :ref:`driver installation <kotlin-sync-download-install>` section of our Get Started
58+
.. guide.
59+
60+
We recommend that you use the `Maven <https://maven.apache.org/>`__ or
61+
`Gradle <https://gradle.org/>`__ build automation tool to manage your project's
62+
dependencies. Select from the following tabs to see the dependency declaration
63+
for that tool:
64+
65+
.. tabs::
66+
67+
.. tab:: Maven
68+
:tabid: maven-dependencies
69+
70+
The following snippet shows the dependency declaration in the
71+
``dependencies`` section of your ``pom.xml`` file.
72+
73+
.. include:: /includes/data-formats/bson-maven-versioned.rst
74+
75+
.. tab:: Gradle
76+
:tabid: gradle-dependencies
77+
78+
The following snippet shows the dependency declaration in the
79+
``dependencies`` object in your ``build.gradle`` file.
80+
81+
.. include:: /includes/data-formats/bson-gradle-versioned.rst
82+
83+
If you are not using one of the preceding tools, you can include it in
84+
your project by downloading the JAR file directly from the
85+
`sonatype repository <https://repo1.maven.org/maven2/org/mongodb/bson/>`__.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. code-block:: kotlin
2+
3+
dependencies {
4+
implementation("org.mongodb:bson:{+patch-version-number+}")
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. code-block:: xml
2+
3+
<dependencies>
4+
<dependency>
5+
<groupId>org.mongodb</groupId>
6+
<artifactId>bson</artifactId>
7+
<version>{+patch-version-number+}</version>
8+
</dependency>
9+
</dependencies>

source/index.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/write-operations
1818
/read
1919
/indexes
20+
/data-formats
2021
/faq
2122
/connection-troubleshooting
2223
/issues-and-help
@@ -76,6 +77,18 @@ Read Data from MongoDB
7677

7778
Learn how you can retrieve data from MongoDB in the :ref:`kotlin-sync-read` section.
7879

80+
Optimize Queries with Indexes
81+
-----------------------------
82+
83+
Learn how to work with common types of indexes in the :ref:`kotlin-sync-indexes`
84+
section.
85+
86+
Specialized Data Formats
87+
------------------------
88+
89+
Learn how to work with specialized data formats and custom types in the
90+
:ref:`kotlin-sync-data-formats` section.
91+
7992
FAQ
8093
---
8194

0 commit comments

Comments
 (0)