Skip to content

Commit 9311ba6

Browse files
committed
add note to Kmongo page
1 parent c8a2c9c commit 9311ba6

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

source/migrate-kmongo.txt

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,31 @@ Overview
1515
--------
1616

1717
This page contains a high-level comparison of most of the ways the official
18-
MongoDB Kotlin and the community-developed KMongo driver differ.
18+
{+driver-long+} and the community-developed KMongo driver differ.
1919
You can use this page to identify the changes you need to make to migrate from
20-
the deprecated KMongo driver to the official MongoDB Kotlin driver.
20+
the deprecated KMongo driver to the official {+driver-long+}.
2121

2222
.. include:: /includes/kmongo-description.rst
2323

24-
The MongoDB Kotlin driver is the officially supported and maintained MongoDB driver for
25-
Kotlin. It is developed by the MongoDB team.
24+
The {+driver-long+} is the officially supported and maintained MongoDB driver for
25+
{+language+}. It is developed by the MongoDB team.
2626

27-
Although both drivers :ref:`support synchronous and asynchronous operations <kotlin-sync-async-support>`,
28-
the examples on this page will use asynchronous coroutine-based operations.
27+
Although both drivers :ref:`support synchronous and asynchronous
28+
operations <kotlin-sync-async-support>`, the examples on this page will
29+
use asynchronous coroutine-based operations.
2930

3031
Connect to MongoDB Cluster
3132
--------------------------
3233

3334
Both drivers let you connect to and communicate with MongoDB clusters from a
34-
Kotlin application.
35+
{+language+} application.
3536

3637
.. tabs::
3738

3839
.. tab::
3940
:tabid: {+driver-long+}
4041

41-
To connect to a MongoDB cluster using the MongoDB Kotlin driver:
42+
To connect to a MongoDB cluster using the {+driver-long+}:
4243

4344
.. code-block:: kotlin
4445

@@ -77,7 +78,7 @@ Kotlin application.
7778
// Get a collection of documents of type Jedi
7879
val col = database.getCollection<Jedi>()
7980

80-
Unlike the MongoDB Kotlin driver, KMongo allows the collection name to be
81+
Unlike the {+driver-long+}, KMongo allows the collection name to be
8182
inferred from the data class name.
8283

8384
CRUD and Aggregation
@@ -91,12 +92,12 @@ operations.
9192
.. tab::
9293
:tabid: {+driver-long+}
9394

94-
The MongoDB Kotlin driver also provides functions for all basic CRUD operations:
95+
The {+driver-long+} also provides functions for all basic CRUD operations:
9596

9697
.. code-block:: kotlin
9798

9899
// Insert a document
99-
val jedi =a Jedi("Luke Skywalker", 19)
100+
val jedi = Jedi("Luke Skywalker", 19)
100101
collection.insertOne(jedi)
101102

102103
// Find a document
@@ -168,6 +169,15 @@ operations.
168169
`Extensions Overview <https://litote.org/kmongo/extensions-overview/>`__ KMongo
169170
documentation.
170171

172+
.. tip::
173+
174+
If you are accustomed to constructing query filters by using the
175+
infix notation available in KMongo, you can also use this notation to
176+
create filters in the official {+driver-short+} by using extension
177+
methods from the ``mongodb-driver-kotlin-extensions`` package. To
178+
learn more and view examples, see the
179+
:ref:`kotlin-builders-data-classes` guide.
180+
171181
Construct Queries
172182
-----------------
173183

@@ -178,7 +188,7 @@ Both drivers provide support for type-safe queries using property references.
178188
.. tab::
179189
:tabid: {+driver-long+}
180190

181-
The MongoDB Kotlin driver uses the Builders API to construct queries.
191+
The {+driver-long+} uses the Builders API to construct queries.
182192
Alternatively, you can use the ``Document`` class.
183193

184194
.. code-block:: kotlin
@@ -198,14 +208,14 @@ Both drivers provide support for type-safe queries using property references.
198208
val projection = Document().append("_id", 0).append("email", 1)
199209
val results = collection.find<Results>(filter).projection(projection)
200210

201-
To map a KMongo string query to the Kotlin driver, you can use the ``JsonObject`` class.
211+
To map a KMongo string query to the {+driver-short+}, you can use the ``JsonObject`` class.
202212

203213
.. code-block:: kotlin
204214

205215
val query = JsonObject("{\"name\": \"Gabriel Garc\\u00eda M\\u00e1rquez\"}")
206216
val jsonResult = collection.find(query).firstOrNull()
207217

208-
For more information, see the following Kotlin driver documentation:
218+
For more information, see the following {+driver-short+} documentation:
209219

210220
- :ref:`Builders <kotlin-builders-landing>`
211221
- :ref:`Documents <kotlin-document-format>` guide
@@ -250,10 +260,19 @@ Both drivers provide support for type-safe queries using property references.
250260
- `Typed Queries <https://litote.org/kmongo/typed-queries/>`_
251261
- `Mongo Shell Queries <https://litote.org/kmongo/mongo-shell-support/>`__
252262

263+
.. tip::
264+
265+
If you are accustomed to constructing query filters by using the
266+
infix notation available in KMongo, you can also use this notation to
267+
create filters in the official {+driver-short+} by using extension
268+
methods from the ``mongodb-driver-kotlin-extensions`` package. To
269+
learn more and view examples, see the
270+
:ref:`kotlin-builders-data-classes` guide.
271+
253272
Data Typing
254273
-----------
255274

256-
Both drivers support the use of Kotlin data classes as well as the ``Document`` class to
275+
Both drivers support the use of {+language+} data classes as well as the ``Document`` class to
257276
model the data stored in a MongoDB collection. The ``Document``
258277
class lets you model data represented in a MongoDB collection in a flexible format.
259278

@@ -263,7 +282,7 @@ class lets you model data represented in a MongoDB collection in a flexible form
263282
:tabid: {+driver-long+}
264283

265284
You can use data classes and ``Document`` classes to model data with the
266-
MongoDB Kotlin driver:
285+
{+driver-long+}:
267286

268287
.. code-block:: kotlin
269288

@@ -302,17 +321,17 @@ Data Serialization
302321
------------------
303322

304323
Both drivers provide support for serializing and deserializing data objects
305-
in Kotlin to and from BSON.
324+
in {+language+} to and from BSON.
306325

307326
.. tabs::
308327

309328
.. tab::
310329
:tabid: {+driver-long+}
311330

312-
You can serialize data classes in the Kotlin driver using both automatic
331+
You can serialize data classes in the {+driver-short+} using both automatic
313332
data class codecs as well as the ``kotlinx.serialization`` library. The
314333
driver provides an efficient ``Bson`` serializer that handles the
315-
serialization of Kotlin objects to BSON data.
334+
serialization of {+language+} objects to BSON data.
316335

317336
.. code-block:: kotlin
318337

@@ -326,7 +345,7 @@ in Kotlin to and from BSON.
326345
val manufacturer: String = "Acme" // Use instead of @BsonProperty
327346
)
328347

329-
To learn more, see the :ref:`Kotlin Serialization <fundamentals-kotlin-serialization>`
348+
To learn more, see the :ref:`{+language+} Serialization <fundamentals-kotlin-serialization>`
330349
documentation.
331350

332351
If you use the ``Document`` class to represent your collection, you can
@@ -381,9 +400,9 @@ Both drivers support synchronous and asynchronous operations.
381400
.. tab::
382401
:tabid: {+driver-long+}
383402

384-
The MongoDB Kotlin driver also has separate libraries for synchronous and
385-
asynchronous operations. However, the Kotlin driver only has built-in support
386-
for coroutines as an asynchronous paradigm. The MongoDB Kotlin driver does not
403+
The {+driver-long+} also has separate libraries for synchronous and
404+
asynchronous operations. However, the {+driver-short+} only has built-in support
405+
for coroutines as an asynchronous paradigm. The {+driver-long+} does not
387406
currently provide support for other asynchronous paradigms such as Reactive
388407
Streams, Reactor, or RxJava2.
389408

@@ -514,5 +533,5 @@ What Next?
514533
----------
515534

516535
Now that you have learned about the differences between KMongo and the MongoDB
517-
Kotlin driver, see the :ref:`Quick Start <kotlin-quickstart>` to get
518-
started using the KMongo Kotlin driver.
536+
{+driver-short+}, see the :ref:`Quick Start <kotlin-quickstart>` to get
537+
started using the KMongo {+driver-short+}.

0 commit comments

Comments
 (0)