-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* DOCSP-46446: v5.3 release * fix examples for bulk * small fix
- Loading branch information
Showing
24 changed files
with
289 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
kotlin.code.style=official | ||
kotlin_mongodb_version=5.2.0 | ||
kotlin_mongodb_version=5.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
source/examples/generated/BulkTest.snippet.replace-model-options.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val opts = ReplaceOptions().sort(Sorts.ascending("_id")) |
1 change: 1 addition & 0 deletions
1
source/examples/generated/BulkTest.snippet.update-model-options.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val opts = UpdateOptions().sort(Sorts.ascending("_id")) |
1 change: 1 addition & 0 deletions
1
source/examples/generated/ChangeTest.snippet.replace-one-options.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val opts = ReplaceOptions().sort(Sorts.ascending(PaintOrder::color.name)) |
1 change: 1 addition & 0 deletions
1
source/examples/generated/ChangeTest.snippet.update-one-options.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val opts = UpdateOptions().sort(Sorts.ascending(PaintOrder::color.name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
.. _kotlin-atlas-vector-search: | ||
|
||
=================== | ||
Atlas Vector Search | ||
=================== | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: reference | ||
|
||
.. meta:: | ||
:keywords: code example, semantic, nearest | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 2 | ||
:class: singlecol | ||
|
||
Overview | ||
-------- | ||
|
||
In this guide, you can learn how to use the :atlas:`Atlas Vector Search | ||
</atlas-vector-search/vector-search-overview/>` feature | ||
in the {+driver-short+}. The ``Aggregates`` builders class provides the | ||
the ``vectorSearch()`` helper method that you can use to | ||
create a :atlas:`$vectorSearch </atlas-vector-search/vector-search-stage/>` | ||
pipeline stage. This pipeline stage allows you to perform a **semantic | ||
search** on your documents. A semantic search is a type of search which | ||
locates information that is similar in meaning, but not necessarily | ||
identical, to your provided search term or phrase. | ||
|
||
.. important:: Feature Compatibility | ||
|
||
To learn what versions of MongoDB Atlas support this feature, see | ||
:atlas:`Limitations </atlas-vector-search/vector-search-stage/#limitations>` | ||
in the MongoDB Atlas documentation. | ||
|
||
Perform a Vector Search | ||
----------------------- | ||
|
||
To use this feature, you must create a vector search index and index your | ||
vector embeddings. To learn about how to programmatically create a | ||
vector search index, see the :ref:`kotlin-search-indexes` section in the | ||
Indexes guide. To learn more about vector embeddings, see | ||
:atlas:`How to Index Vector Embeddings for Vector Search | ||
</atlas-search/field-types/knn-vector/>` in the Atlas documentation. | ||
|
||
After you create a vector search index on your vector embeddings, you | ||
can reference this index in your pipeline stage, as shown in the | ||
following section. | ||
|
||
Vector Search Example | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The example in this section uses data modeled with the following Kotlin data class: | ||
|
||
.. literalinclude:: /examples/generated/AggregatesBuilderTest.snippet.vector-search-data-class.kt | ||
:language: kotlin | ||
|
||
This example shows how to build an aggregation pipeline that uses the | ||
``vectorSearch()`` method to perform an exact vector search with the following | ||
specifications: | ||
|
||
- Searches ``plotEmbedding`` field values by using vector embeddings of a | ||
string value | ||
- Uses the ``mflix_movies_embedding_index`` vector search index | ||
- Returns 1 document | ||
- Filters for documents in which the ``year`` value is at least ``2016`` | ||
|
||
.. literalinclude:: /examples/generated/AggregatesBuilderTest.snippet.vector-search.kt | ||
:language: kotlin | ||
|
||
.. tip:: Query Vector Type | ||
|
||
The preceding example creates an instance of ``BinaryVector`` to | ||
serve as the query vector, but you can also create a ``List`` of | ||
``Double`` instances. However, we recommend that you use the | ||
``BinaryVector`` type to improve storage efficiency. | ||
|
||
.. tip:: {+language+} Vector Search Examples | ||
|
||
Visit the :atlas:`Atlas documentation </atlas-vector-search/tutorials/>` | ||
to find more tutorials on using the {+driver-short+} to perform Atlas | ||
Vector Searches. | ||
|
||
API Documentation | ||
----------------- | ||
|
||
To learn more about the methods and types mentioned in this | ||
guide, see the following API documentation: | ||
|
||
- `Aggregates.vectorSearch() | ||
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#vectorSearch(com.mongodb.client.model.search.FieldSearchPath,java.lang.Iterable,java.lang.String,long,com.mongodb.client.model.search.VectorSearchOptions)>`__ | ||
|
||
- `FieldSearchPath | ||
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/search/FieldSearchPath.html>`__ | ||
|
||
- `VectorSearchOptions | ||
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/search/VectorSearchOptions.html>`__ | ||
|
||
- `BinaryVector <{+api+}/apidocs/bson/org/bson/BinaryVector.html>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.