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
2 changes: 1 addition & 1 deletion config/redirects
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define: prefix docs/drivers/java/sync
define: base https://www.mongodb.com/${prefix}
define: versions v4.3 v4.4 v4.5 v4.6 v4.7 v4.8 v4.9 v4.10 v4.11 v5.0 v5.1 master
define: versions v4.3 v4.4 v4.5 v4.6 v4.7 v4.8 v4.9 v4.10 v4.11 v5.0 v5.1 v5.2 master

raw: ${prefix}/ -> ${base}/current/
raw: ${prefix}/master -> ${base}/upcoming/
Expand Down
4 changes: 2 additions & 2 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
driver = "java"
driver-long = "MongoDB Java Driver"
driver-short = "Java driver"
version = "5.1"
full-version = "{+version+}.4"
version = "5.2"
full-version = "{+version+}.0"
mdb-server = "MongoDB Server"
package-name-org = "mongodb-org"
api = "https://mongodb.github.io/mongo-java-driver/{+version+}"
Expand Down
12 changes: 8 additions & 4 deletions source/fundamentals/builders/aggregates.txt
Original file line number Diff line number Diff line change
Expand Up @@ -992,15 +992,17 @@ Atlas Vector Search
:atlas:`Limitations </atlas-vector-search/vector-search-stage/#limitations>`
in the MongoDB Atlas documentation.

Use the ``vectorSearch()`` method to create a :atlas:`$vectorSearch </atlas-vector-search/vector-search-stage/>`
Use the ``vectorSearch()`` method to create a :atlas:`$vectorSearch
</atlas-vector-search/vector-search-stage/>`
pipeline stage that specifies a **semantic search**. A semantic search is
a type of search which locates information that is similar in meaning.

To use this feature, you must set up a vector search index and index your
vector embeddings. To learn about how to programmatically create a
vector search index, see the :ref:`java-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/>`.
:atlas:`How to Index Vector Embeddings for Vector Search
</atlas-search/field-types/knn-vector/>`.

The following example shows how to build an aggregation pipeline that uses the
``vectorSearch()`` and ``project()`` methods to compute a vector search score:
Expand All @@ -1020,5 +1022,7 @@ preceding aggregation pipeline:
:language: java
:dedent:

Learn more about this helper from the
`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,long)>`__ API documentation.
Learn more about this helper in the
`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)>`__
API documentation.
5 changes: 5 additions & 0 deletions source/fundamentals/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ The following code example shows how to create an Atlas Search index:
:start-after: start create-search-index
:end-before: end create-search-index

To create multiple Search or Vector Search indexes, you must create a
`SearchIndexModel
<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/SearchIndexModel.html>`__
instance for each index.

The following code example shows how to create Search and
Vector Search indexes in one call:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mongodb.client.*;
import com.mongodb.client.model.SearchIndexModel;
import com.mongodb.client.model.SearchIndexType;
import org.bson.Document;

import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static com.mongodb.client.model.Sorts.*;
import static com.mongodb.client.model.Accumulators.*;
import static com.mongodb.client.model.search.SearchPath.fieldPath;
import static com.mongodb.client.model.search.VectorSearchOptions.vectorSearchOptions;
import static com.mongodb.client.model.search.VectorSearchOptions.exactVectorSearchOptions;
import static java.util.Arrays.asList;
// end static import

Expand Down Expand Up @@ -317,16 +317,14 @@ private void vectorSearchPipeline() {
List<Double> queryVector = (asList(-0.0072121937, -0.030757688, -0.012945653));
String indexName = "mflix_movies_embedding_index";
FieldSearchPath fieldSearchPath = fieldPath("plot_embedding");
int numCandidates = 2;
int limit = 1;
VectorSearchOptions options = vectorSearchOptions().filter(gte("year", 2016));
VectorSearchOptions options = exactVectorSearchOptions().filter(gte("year", 2016));

List<Bson> pipeline = asList(
vectorSearch(
fieldSearchPath,
queryVector,
indexName,
numCandidates,
limit,
options),
project(
Expand Down
202 changes: 2 additions & 200 deletions source/includes/language-compatibility-table-java.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- Java 6
- Java 5

* - 5.1
* - 4.11 to 5.2
- ✓
- ✓
- ✓
Expand All @@ -21,70 +21,7 @@
-
-

* - 5.0
- ✓
- ✓
- ✓
- ✓
-
-
-

* - 4.11
- ✓
- ✓
- ✓
- ✓
-
-
-

* - 4.10
- ✓ [#virtual-threads-note]_
- ✓
- ✓
- ✓
-
-
-

* - 4.9
- ✓ [#virtual-threads-note]_
- ✓
- ✓
- ✓
-
-
-

* - 4.8
- ✓ [#virtual-threads-note]_
- ✓
- ✓
- ✓
-
-
-

* - 4.7
- ✓ [#virtual-threads-note]_
- ✓
- ✓
- ✓
-
-
-

* - 4.6
- ✓ [#virtual-threads-note]_
- ✓
- ✓
- ✓
-
-
-

* - 4.5
* - 4.7 to 4.10
- ✓ [#virtual-threads-note]_
- ✓
- ✓
Expand All @@ -93,139 +30,4 @@
-
-

* - 4.4
-
- ✓
- ✓
- ✓
-
-
-

* - 4.3
-
-
- ✓
- ✓
-
-
-

* - 4.2
-
-
- ✓
- ✓
-
-
-

* - 4.1
-
-
- ✓
- ✓
-
-
-

* - 4.0
-
-
- ✓
- ✓
-
-
-

* - 3.12
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.11
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.10
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.9
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.8
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.4
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.3
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.2
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.1
-
-
- ✓
- ✓
- ✓
- ✓
-

* - 3.0
-
-
- ✓
- ✓
- ✓
- ✓
-

.. [#virtual-threads-note] This driver version is not compatible with virtual threads.
Loading
Loading