-
Notifications
You must be signed in to change notification settings - Fork 10
DOCSP-42607: v5.2 changes #48
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -297,4 +297,98 @@ deserializes them accordingly. | |||||
|
||||||
Retrieving as Document type | ||||||
Document{{_id=..., _t=Teacher, name=Vivian Lee, department=History}} | ||||||
Document{{_id=..., _t=Student, name=Kate Parker, grade=10}} | ||||||
Document{{_id=..., _t=Student, name=Kate Parker, grade=10}} | ||||||
|
||||||
.. _kotlin-sync-datetime-serialization: | ||||||
|
||||||
Serialize Dates and Times | ||||||
------------------------- | ||||||
|
||||||
In this section, you can learn about using {+language+} serialization to | ||||||
work with date and time types. | ||||||
|
||||||
kotlinx-datetime Library | ||||||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
||||||
``kotlinx-datetime`` is a {+language+} library that offers | ||||||
a high level of control over how your date and time values | ||||||
are serialized. To use the library, add the ``kotlinx-datetime`` | ||||||
dependency to your project's dependency list. | ||||||
|
||||||
Select from the following tabs to see how to add the ``kotlinx-datetime`` | ||||||
dependency to your project by using the :guilabel:`Gradle` and | ||||||
:guilabel:`Maven` package managers: | ||||||
|
||||||
.. tabs:: | ||||||
|
||||||
.. tab:: | ||||||
:tabid: Gradle | ||||||
|
||||||
.. code-block:: kotlin | ||||||
:caption: build.gradle.kts | ||||||
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:{+kotlinx-dt-version+}") | ||||||
|
||||||
.. tab:: | ||||||
:tabid: Maven | ||||||
|
||||||
.. code-block:: kotlin | ||||||
:caption: pom.xml | ||||||
|
||||||
<dependency> | ||||||
<groupId>org.jetbrains.kotlinx</groupId> | ||||||
<artifactId>kotlinx-datetime-jvm</artifactId> | ||||||
<version>{+kotlinx-dt-version+}</version> | ||||||
</dependency> | ||||||
|
||||||
To learn more about this library, see the :github:`kotlinx-datetime repository | ||||||
</Kotlin/kotlinx-datetime>` on GitHub. | ||||||
|
||||||
Example Data Class with Dates and Times | ||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
||||||
After you add the library dependency, you can implement serializers from | ||||||
the ``kotlinx-datetime`` library that map your data class field values | ||||||
to the expected types in BSON. | ||||||
|
||||||
In the following example, the driver serializes the fields of | ||||||
the ``Appointment`` data class with the following behavior: | ||||||
|
||||||
- ``name``: The driver serializes the value as a string. | ||||||
|
||||||
- ``date``: The driver uses the ``kotlinx-datetime`` serializer | ||||||
because the field has the ``@Contextual`` annotation. ``LocalDate`` | ||||||
values are serialized as BSON dates. | ||||||
|
||||||
- ``time``: The driver serializes the value as a string because it does | ||||||
not have the ``@Contextual`` annotation. This is the default | ||||||
serialization behavior for ``LocalTime`` values. | ||||||
|
||||||
.. literalinclude:: /includes/data-formats/serialization.kt | ||||||
:language: kotlin | ||||||
:start-after: start-datetime-data-class | ||||||
:end-before: end-datetime-data-class | ||||||
:dedent: | ||||||
|
||||||
The following example inserts an instance of the ``Appointment`` data | ||||||
class into MongoDB: | ||||||
|
class into MongoDB: | |
class into a MongoDB collection named "appointments": |
Outdated
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.
S: remove extra space
``time`` field is stored as a string by default serialization: | |
``time`` field is stored as a string by default serialization: |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,8 +1,9 @@ | ||||||
.. _kotlin-sync-atlas-search-index: | ||||||
.. _kotlin-sync-search-avs-indexes: | ||||||
|
||||||
==================== | ||||||
Atlas Search Indexes | ||||||
==================== | ||||||
====================================== | ||||||
Atlas Search and Vector Search Indexes | ||||||
====================================== | ||||||
|
||||||
.. contents:: On this page | ||||||
:local: | ||||||
|
@@ -20,12 +21,23 @@ Atlas Search Indexes | |||||
Overview | ||||||
-------- | ||||||
|
||||||
:atlas:`Atlas Search </atlas-search>` enables you to perform full-text searches on | ||||||
You can programmatically manage your :atlas:`Atlas Search | ||||||
</atlas-search>` and :atlas:`Atlas Vector Search | ||||||
</atlas-vector-search/vector-search-overview/>` indexes by using the | ||||||
{+driver-short+}. | ||||||
|
||||||
Atlas Search enables you to perform full-text searches on | ||||||
collections hosted on MongoDB Atlas. Atlas Search indexes specify the behavior of | ||||||
the search and which fields to index. | ||||||
|
||||||
You can call the following methods on a collection to manage your Atlas Search | ||||||
indexes: | ||||||
Atlas Vector Search enables you to perform semantic searches on vector | ||||||
embeddings stored in MongoDB Atlas. Vector Search indexes define the | ||||||
indexes for the vector embeddings that you want to query and the boolean, | ||||||
date, objectId, numeric, string, or UUID values that you want to use to | ||||||
pre-filter your data. | ||||||
|
||||||
You can call the following methods on a collection to manage your Atlas | ||||||
Search and Vector Search indexes: | ||||||
|
||||||
- ``createSearchIndex()`` | ||||||
- ``createSearchIndexes()`` | ||||||
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: Does the note below (can't comment on it directly) apply just to Atlas Search indexes? If it applies to Vector search index methods as well, I'd update it to reflect that |
||||||
|
@@ -50,13 +62,7 @@ Create a Search Index | |||||
You can use the `createSearchIndex() | ||||||
<{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-search-index.html>`__ | ||||||
and the `createSearchIndexes() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-search-indexes.html>`__ | ||||||
methods to create one or more Atlas Search indexes. | ||||||
|
||||||
You can also use these methods to create Atlas Vector Search Indexes. | ||||||
Atlas Vector Search enables you to perform semantic searches on vector | ||||||
embeddings stored in MongoDB Atlas. To learn more about this feature, | ||||||
see the :atlas:`Atlas Vector Search Overview | ||||||
</atlas-vector-search/vector-search-overview/>`. | ||||||
methods to create one or more Atlas Search or Vector Search indexes. | ||||||
|
||||||
The following code example shows how to create an Atlas Search index: | ||||||
|
||||||
|
@@ -66,7 +72,8 @@ The following code example shows how to create an Atlas Search index: | |||||
:end-before: end-create-search-index | ||||||
:dedent: | ||||||
|
||||||
The following code example shows how to create multiple indexes: | ||||||
The following code example shows how to create Search and | ||||||
|
The following code example shows how to create Search and | |
The following code example shows how to create Atlas Search and |
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.
S: [nit] Since this sentence repeats "following", you could reword to just "this example":