-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOCPS-41150: Specialized Data Formats + BSON #19
Changes from 6 commits
ce9663d
9018d96
22b4198
8a80fee
b06fb85
9a99acd
2dfb19e
19d1abf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. _kotlin-sync-data-formats: | ||
|
||
======================== | ||
Specialized Data Formats | ||
======================== | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 2 | ||
:class: singlecol | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: reference | ||
|
||
.. meta:: | ||
:keywords: bson, data, class, date, time | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
:maxdepth: 1 | ||
|
||
/data-formats/bson | ||
|
||
.. TODO: /data-formats/data-class | ||
.. TODO: /data-formats/extended-json | ||
.. TODO: /data-formats/time-series | ||
|
||
Overview | ||
-------- | ||
|
||
You can use several types of specialized document data formats in your {+driver-short+} | ||
application. To learn how to work with these data formats, see the following | ||
sections: | ||
|
||
- Learn how to work with the BSON data format in the :ref:`BSON <kotlin-sync-bson>` guide. | ||
|
||
.. TODO: Uncomment these as pages get built | ||
.. - Learn how to store and retrieve data using {+language+} data classes in the :ref:`data-classes` guide. | ||
.. - Learn how to use the Extended JSON format in the :ref:`kotlin-sync-extended-json` guide. | ||
.. - Learn how to store and interact with time series data in the :ref:`kotlin-sync-time-series` guide. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
.. _kotlin-sync-bson: | ||
|
||
========================== | ||
Document Data Format: BSON | ||
========================== | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 2 | ||
:class: singlecol | ||
|
||
Overview | ||
-------- | ||
|
||
In this guide, you can learn about the BSON data format, how MongoDB | ||
uses BSON to organize and store data, and how to install the BSON library independently of | ||
the {+driver-short+}. | ||
|
||
BSON Data Format | ||
---------------- | ||
|
||
**BSON**, or Binary JSON, is the data format that MongoDB uses to organize | ||
and store data. This data format includes all JSON data structure types and | ||
adds support for types including dates, differently-sized integers (32-bit and 64-bit), | ||
ObjectIds, and binary data. For a complete list of supported types, see the | ||
:manual:`BSON Types </reference/bson-types>` in the {+mdb-server+} documentation. | ||
|
||
BSON is not human-readable, but you can use the | ||
:ref:`BSON library <install-bson-library>` to convert it to the human-readable JSON | ||
representation. You can read more about the relationship between these | ||
formats in the :website:`JSON and BSON </json-and-bson>` guide on the MongoDB website. | ||
|
||
MongoDB and BSON | ||
---------------- | ||
|
||
You can work with BSON data in your {+driver-short+} application by using one of the | ||
following object types that implements the `BSON interface <{+java-api+}/apidocs/bson/org/bson/conversions/Bson.html>`__: | ||
|
||
- `Document <{+java-api+}/apidocs/bson/org/bson/Document.html>`__ (BSON library package) | ||
- `BsonDocument <{+java-api+}/apidocs/bson/org/bson/BsonDocument.html>`__ (BSON library package) | ||
- `RawBsonDocument <{+java-api+}/apidocs/bson/org/bson/RawBsonDocument.html>`__ (BSON library package) | ||
- `JsonObject <{+java-api+}/apidocs/bson/org/bson/json/JsonObject.html>`__ (BSON library package) | ||
|
||
.. _install-bson-library: | ||
|
||
Install the BSON Library | ||
------------------------ | ||
|
||
These instructions detail how to add the BSON library as a dependency to | ||
your project. | ||
|
||
.. note:: | ||
|
||
If you have already added the {+driver-short+} as a dependency to your | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: I'm a little confused on the use case where a user would not have the driver installed but would need to install just the BSON library as a dependency, given that this page talks about using BSON with the user's Kotlin sync application There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good question – I'm not sure why the other driver versions of this page have this section. I can raise it to the team at large to see if anyone has context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update: There have been cases where developers are interested in this. Although developers who find this page after they've already been in the Kotlin docs might not need this, it could be helpful for developers who find the docs through external sources (e.g. googling). |
||
project, then you can skip this step. This is because the BSON library is already | ||
included as a required dependency of the driver. | ||
|
||
.. TODO: For instructions on how to add the | ||
.. MongoDB Kotlin driver as a dependency to your project, see the | ||
.. :ref:`driver installation <kotlin-sync-download-install>` section of our Get Started | ||
.. guide. | ||
|
||
We recommend that you use the `Maven <https://maven.apache.org/>`__ or | ||
`Gradle <https://gradle.org/>`__ build automation tool to manage your {+language+} | ||
project's dependencies. The following instructions detail the dependency declarations for | ||
both Maven and Gradle: | ||
|
||
.. tabs:: | ||
|
||
.. tab:: Maven | ||
:tabid: maven-dependencies | ||
|
||
The following snippet shows the dependency declaration in the | ||
``dependencies`` section of your ``pom.xml`` file. | ||
|
||
.. include:: /includes/data-formats/bson-maven-versioned.rst | ||
|
||
.. tab:: Gradle | ||
:tabid: gradle-dependencies | ||
|
||
The following snippet shows the dependency declaration in the | ||
``dependencies`` object in your ``build.gradle`` file. | ||
|
||
.. include:: /includes/data-formats/bson-gradle-versioned.rst | ||
|
||
If you are not using either of the preceding tools, then you can include the BSON dependency | ||
in your project by downloading the JAR file directly from the | ||
`sonatype repository <https://repo1.maven.org/maven2/org/mongodb/bson/>`__. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.. code-block:: kotlin | ||
|
||
dependencies { | ||
implementation("org.mongodb:bson:{+patch-version-number+}") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. code-block:: xml | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.mongodb</groupId> | ||
<artifactId>bson</artifactId> | ||
<version>{+patch-version-number+}</version> | ||
</dependency> | ||
</dependencies> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: How MongoDB uses it feels a little vague to me. How about something like:
"How MongoDB uses BSON to organize and store data"?