Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions examples/src/test/kotlin/QueryDocumentTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import org.junit.jupiter.api.TestInstance
import java.util.*
import kotlin.test.*

// TODO: light refactor on these examples so that they don't collect directly from find() op, but rather assign to val findFlow
// and then collect/println from that for consistency with other examples
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class QueryDocumentTest {
// :snippet-start: query-data-model
Expand Down Expand Up @@ -67,22 +65,24 @@ internal class QueryDocumentTest {
fun comparisonQueryTest() = runBlocking {
// :snippet-start: comparison-filter
val filter = Filters.gt("qty", 7)
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
// :snippet-end:
// Junit test for the above code
val expected = listOf(
PaintOrder(1, 9, "red", listOf("A", "E")),
PaintOrder(2, 8, "purple", listOf("B", "D", "F"), 5),
PaintOrder(7, 8, "green", listOf("C", "E"), 7)
)
assertEquals(expected, collection.find(filter).toList() )
assertEquals(expected, findFlow.toList() )
}

@Test
fun logicalQueryTest() = runBlocking {
// :snippet-start: logical-filter
val filter = Filters.and(Filters.lte("qty", 5), Filters.ne("color", "pink"))
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
// :snippet-end:
// Junit test for the above code
val expected = listOf(
Expand All @@ -96,42 +96,45 @@ internal class QueryDocumentTest {
fun arrayQueryTest() = runBlocking {
// :snippet-start: array-filter
val filter = Filters.size("vendor", 3)
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
// :snippet-end:
// Junit test for the above code
val expected = listOf(
PaintOrder(2, 8, "purple", listOf("B", "D", "F"), 5),
PaintOrder(8, 7, "black", listOf("A", "C", "D"))
)
assertEquals(expected, collection.find(filter).toList() )
assertEquals(expected, findFlow.toList() )
}

@Test
fun elementQueryTest() = runBlocking {
// :snippet-start: element-filter
val filter = Filters.exists("rating")
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
// :snippet-end:
// Junit test for the above code
val expected = listOf(
PaintOrder(2, 8, "purple", listOf("B", "D", "F"), 5),
PaintOrder(4, 6, "white", listOf("D"), 9),
PaintOrder(7, 8, "green", listOf("C", "E"), 7)
)
assertEquals(expected, collection.find(filter).toList() )
assertEquals(expected, findFlow.toList() )
}

@Test
fun evaluationQueryTest() = runBlocking {
// :snippet-start: evaluation-filter
val filter = Filters.regex("color", "k$")
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
// :snippet-end:
// Junit test for the above code
val expected = listOf(
PaintOrder(6, 3, "pink", listOf("C")),
PaintOrder(8, 7, "black", listOf("A", "C", "D"))
)
assertEquals(expected, collection.find(filter).toList() )
assertEquals(expected, findFlow.toList() )
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val filter = Filters.size("vendor", 3)
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val filter = Filters.gt("qty", 7)
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val filter = Filters.exists("rating")
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val filter = Filters.regex("color", "k$")
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val filter = Filters.and(Filters.lte("qty", 5), Filters.ne("color", "pink"))
collection.find(filter).collect { println(it) }
val findFlow = collection.find(filter)
findFlow.collect { println(it) }
5 changes: 2 additions & 3 deletions source/fundamentals/auth.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ Edition are as follows:
* :ref:`MONGODB-AWS <mongodb-aws-auth-mechanism>`
* :ref:`X.509 <x509-auth-mechanism>`

.. TODO (DOCSP-29270) Add back when Enterprise Auth is available
.. To authenticate using ``Kerberos`` or ``LDAP``, see the
.. :doc:`Enterprise Authentication Mechanisms guide </fundamentals/enterprise-auth>`.
To authenticate using ``Kerberos`` or ``LDAP``, see the
:doc:`Enterprise Authentication Mechanisms guide </fundamentals/enterprise-auth>`.

For more information on establishing a connection to your MongoDB cluster,
read our :doc:`Connection Guide </fundamentals/connection>`.
Expand Down
5 changes: 2 additions & 3 deletions source/fundamentals/connection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ sections:
- :ref:`Enable Network Compression <network-compression>`
- :ref:`Enable TLS/SSL on a Connection <tls-ssl>`

.. TODO:(DOCSP-29261) Add auth docs back in
.. For information about authenticating with a MongoDB instance,
.. see :ref:`<authentication-mechanisms>` and :ref:`<enterprise-authentication-mechanisms>`.
For information about authenticating with a MongoDB instance,
see :ref:`<authentication-mechanisms>` and :ref:`<enterprise-authentication-mechanisms>`.
18 changes: 8 additions & 10 deletions source/fundamentals/connection/connect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ To learn more about how connection pools work in the driver, see the :ref:`FAQ p
All resource usage limits, such as max connections, apply to individual
``MongoClient`` instances.

.. TODO:(DOCSP-29267) add content when MongoClient Settings page is added back
.. To learn about the different settings you can use to control the
.. behavior of your ``MongoClient``, see the guide on
.. :ref:`MongoClient Settings <specify-mongoclient-settings>`.
To learn about the different settings you can use to control the
behavior of your ``MongoClient``, see the guide on
:ref:`MongoClient Settings <specify-mongoclient-settings>`.

.. tip::

Expand All @@ -60,13 +59,12 @@ This figure uses the :manual:`Standard Connection String Format </reference/conn
``mongodb+srv``, if you want more flexibility of deployment and the ability
to change the servers in rotation without reconfiguring clients.

.. TODO:(DOCSP-29372) add back when kotlin content added to the Atlas docs
.. .. note::
.. note::

.. If your deployment is on MongoDB Atlas, see the
.. :atlas:`Atlas driver connection guide </driver-connection?jmp=docs_driver_kotlin>`
.. and select Kotlin from the language dropdown to retrieve your connection
.. string.
If your deployment is on MongoDB Atlas, see the
:atlas:`Atlas driver connection guide </driver-connection?jmp=docs_driver_kotlin>`
and select :guilabel:`Kotlin` from the language dropdown to retrieve your connection
string.

The next part of the connection URI contains your credentials if you are
using a password-based authentication mechanism. Replace the value of ``user``
Expand Down
7 changes: 1 addition & 6 deletions source/fundamentals/connection/connection-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,10 @@ parameters of the connection URI to specify the behavior of the client.

* - **authMechanism**
- string
- Specifies the authentication mechanism
- Specifies the :doc:`authentication mechanism </fundamentals/auth>`
that the driver should use if a credential
was supplied.

.. TODO:(DOCSP-29261) refactor above to:
.. Specifies the :doc:`authentication mechanism
.. </fundamentals/auth>` that the driver should use if a credential
.. was supplied.

| **Default**: By default, the client picks the most secure
mechanism available based on the server version. For possible
values, see the server documentation for the
Expand Down
3 changes: 1 addition & 2 deletions source/fundamentals/crud/read-operations/change-streams.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ following text:
...
}

.. TODO:(DOCSP-29258) add in
.. For a runnable example, see the :ref:`<kotlin-usage-watch>` usage example page.
For a runnable example, see the :ref:`<kotlin-usage-watch>` usage example page.

To learn more about the ``watch()`` method, see the following API
documentation:
Expand Down
8 changes: 2 additions & 6 deletions source/fundamentals/crud/write-operations/insert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ see the following resources:
- `insertOne() <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/insert-one.html>`__ API Documentation
- `InsertOneResult <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/result/InsertOneResult.html>`__ API Documentation
- Manual Explanation on :manual:`insertOne() </reference/method/db.collection.insertOne/>`

.. TODO(DOCSP-29251): add back
.. - Runnable :doc:`Insert a Document Example </usage-examples/insertOne>`
- Runnable :doc:`Insert a Document example </usage-examples/insertOne>`

Insert Multiple Documents
-------------------------
Expand Down Expand Up @@ -169,9 +167,7 @@ see the following resources:
- `insertMany() <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/insert-many.html>`__ API Documentation
- `InsertManyResult <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/result/InsertManyResult.html>`__ API Documentation
- Manual Explanation on :manual:`insertMany() </reference/method/db.collection.insertMany/>`

.. TODO(DOCSP-29251): add back
.. - Runnable :doc:`Insert Multiple Documents Example </usage-examples/insertMany>`
- Runnable :doc:`Insert Multiple Documents example </usage-examples/insertMany>`

Summary
-------
Expand Down
1 change: 0 additions & 1 deletion source/includes/fundamentals-sections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ Fundamentals section:
- :doc:`Encrypt Fields in a Document </fundamentals/encrypt-fields>`

.. TODO : add back in after MVP
.. - :doc:`Transform your Data </fundamentals/aggregation>`
.. - :doc:`Store and Retrieve Large Files in MongoDB </fundamentals/gridfs>`
16 changes: 14 additions & 2 deletions source/quick-reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ The examples on the page use the following data class to represent MongoDB docum
.. literalinclude:: /examples/generated/QuickReferenceTest.snippet.data-model.kt
:language: kotlin

.. TODO: when usage examples added back in, add them to links on this page

.. list-table::
:header-rows: 1
:widths: 25 75
Expand All @@ -24,6 +22,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Find a Document**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/find.html>`__
| :ref:`Usage Example <kotlin-usage-findone>`
| :ref:`Fundamentals <kotlin-fundamentals-retrieve-data>`

- .. io-code-block::
Expand All @@ -41,6 +40,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Find Multiple Documents**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/find.html>`__
| :ref:`Usage Example <kotlin-usage-find>`
| :ref:`Fundamentals <kotlin-fundamentals-retrieve-data>`

- .. io-code-block::
Expand All @@ -64,6 +64,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Insert a Document**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/insert-one.html>`__
| :ref:`Usage Example <kotlin-usage-insertone>`
| :ref:`Fundamentals <kotlin-fundamentals-insert>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.insert-document.kt
Expand All @@ -72,6 +73,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Insert Multiple Documents**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/insert-many.html>`__
| :ref:`Usage Example <kotlin-usage-insertmany>`
| :ref:`Fundamentals <kotlin-fundamentals-insert>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.insert-multiple-documents.kt
Expand All @@ -80,6 +82,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Update a Document**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/update-one.html>`__
| :ref:`Usage Example <kotlin-usage-updateone>`
| :ref:`Fundamentals <kotlin-fundamentals-update>`

- .. io-code-block::
Expand All @@ -97,6 +100,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Update Multiple Documents**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/update-many.html>`__
| :ref:`Usage Example <kotlin-usage-updatemany>`
| :ref:`Fundamentals <kotlin-fundamentals-update>`

- .. io-code-block::
Expand Down Expand Up @@ -137,6 +141,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Replace a Document**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/replace-one.html>`__
| :ref:`Usage Example <kotlin-usage-replaceone>`
| :ref:`Fundamentals <replace-operation>`

- .. io-code-block::
Expand All @@ -154,6 +159,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Delete a Document**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/delete-one.html>`__
| :ref:`Usage Example <kotlin-usage-deleteone>`
| :ref:`Fundamentals <kotlin-fundamentals-delete>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.delete-document.kt
Expand All @@ -162,6 +168,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Delete Multiple Documents**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/delete-many.html>`__
| :ref:`Usage Example <kotlin-usage-deletemany>`
| :ref:`Fundamentals <kotlin-fundamentals-delete>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.delete-multiple-documents.kt
Expand All @@ -170,6 +177,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Bulk Write**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/bulk-write.html>`__
| :ref:`Usage Example <kotlin-usage-bulkwrite>`
| :ref:`Fundamentals <kotlin-fundamentals-bulkwrite>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.bulk-write.kt
Expand All @@ -178,6 +186,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Watch for Changes**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/watch.html>`__
| :ref:`Usage Example <kotlin-usage-watch>`
| :ref:`Fundamentals <retrieve-watch>`

- .. literalinclude:: /examples/generated/QuickReferenceTest.snippet.watch-for-changes.kt
Expand Down Expand Up @@ -205,6 +214,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Count Documents**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/count-documents.html>`__
| :ref:`Usage Example <kotlin-usage-count>`

- .. io-code-block::
:copyable: true
Expand All @@ -220,6 +230,7 @@ The examples on the page use the following data class to represent MongoDB docum

* - | **List the Distinct Documents or Field Values**
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-mongo-collection/distinct.html>`__
| :ref:`Usage Example <kotlin-usage-distinct>`

- .. io-code-block::
:copyable: true
Expand Down Expand Up @@ -301,6 +312,7 @@ The examples on the page use the following data class to represent MongoDB docum
* - | **Project Document Fields When Retrieving Them**
|
| `API Documentation <{+api-kotlin+}/apidocs/mongodb-driver-kotlin-coroutine/mongodb-driver-kotlin-coroutine/com.mongodb.kotlin.client.coroutine/-find-flow/projection.html>`__
| :ref:`Usage Example <kotlin-usage-find>`
| :ref:`Fundamentals <kotlin-fundamentals-project>`

- .. io-code-block::
Expand Down
5 changes: 2 additions & 3 deletions source/quick-start.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ of the movie from the sample dataset which should look something like this:
cast=[Michael J. Fox, Christopher Lloyd, Lea Thompson, Crispin Glover]
)

.. TODO:(DOCSP-29224): add back in when document data format data classes are documented
.. To learn more about using data classes to store and retrieve data, refer to
.. :ref:`Document Data Format: Data Classes <fundamentals-data-classes>`.
To learn more about using data classes to store and retrieve data, refer to
:ref:`Document Data Format: Data Classes <fundamentals-data-classes>`.

If you receive no output or an error, check whether you included the proper
connection string in your Kotlin class, and whether you loaded the sample dataset
Expand Down
8 changes: 2 additions & 6 deletions source/usage-examples/updateOne.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ in the ``movies`` collection of the ``sample_mflix`` database:
We use the ``Updates`` builder, a factory class that contains static
helper methods, to construct the update document. While you can pass an update
document instead of using the builder, the builder provides type checking and
simplified syntax. See the `Updates <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Updates.html>`__
class documentation for more information.

.. TODO: (DOCSP-29266) Replace above with link to the Updates builder documentation once available
.. For more information on the ``Updates`` builder, see our
.. :doc:`guide on the Updates builder </fundamentals/builders/updates/>`.
simplified syntax. See the :doc:`guide on the Updates builder </fundamentals/builders/updates/>`
for more information.

.. include:: /includes/connect-guide-note.rst

Expand Down