Skip to content

Comp cov #128

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

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6dc5793
DOCSP-51351-reorganize-toc (#106)
shuangela Jul 7, 2025
4265714
DOCSP-51320: Document causal consistency (#108)
mcmorisi Jul 9, 2025
d70ee63
add logging overview (#112)
shuangela Jul 9, 2025
546c88e
DOCSP-51345: Document polling SRV records (#107)
mcmorisi Jul 10, 2025
d56dcd3
DOCSP-51326-add-find-one (#114)
shuangela Jul 14, 2025
3bfbf9c
DOCSP-51408-connection-troubleshooting (#109)
shuangela Jul 15, 2025
294b18c
DOCSP-51323: Databases & collections (#111)
norareidy Jul 16, 2025
7c94562
DOCSP-51341: Extended JSON (#116)
norareidy Jul 16, 2025
6f62210
DOCSP-51324: Network Compression (#110)
mcmorisi Jul 17, 2025
c8b17c1
DOCSP-51350: Vector search queries (#117)
norareidy Jul 17, 2025
4d6d754
DOCSP-51321: Configure CRUD operations (#113)
norareidy Jul 21, 2025
4be94d7
DOCSP-51327-add-upsert (#121)
shuangela Jul 22, 2025
db6738d
DOCSP-51407: Auth reorganization (#120)
norareidy Jul 23, 2025
0ce6dd9
DOCSP-51283: noindex short pages (#124)
norareidy Jul 24, 2025
6481fad
DOCSP-52259-edit-aggregation-page (#123)
shuangela Jul 24, 2025
48d1336
update credentials (#125)
shuangela Jul 24, 2025
9084089
DOCSP-51348-atlas-search-page (#122)
shuangela Jul 25, 2025
f337e8f
DOCSP-51349: Upgrade guide (#127)
norareidy Jul 25, 2025
33fb65a
DOCSP-51347: Server Selection (#118)
mcmorisi Jul 25, 2025
e7771df
DOCSP-51344: Logging (#115)
mcmorisi Jul 28, 2025
cf2870d
DOCSP-51889-retryable-reads-and-writes (#126)
shuangela Jul 28, 2025
6c85c3b
DOCSP-51325: Connection pools (#119)
norareidy Jul 29, 2025
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
21 changes: 21 additions & 0 deletions config/redirects
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,24 @@ symlink: current -> v5.5
raw: ${prefix}/ -> ${base}/current/
raw: ${prefix}/master -> ${base}/upcoming/
[v5.1-*]: ${prefix}/${version}/get-started/connect-to-mongodb -> ${base}/${version}/get-started/run-sample-query/

[*-master]: ${prefix}/${version}/connect/tls -> ${base}/${version}/security/tls
[*-master]: ${prefix}/${version}/write/insert -> ${base}/${version}/crud/insert
[*-master]: ${prefix}/${version}/write/update -> ${base}/${version}/crud/update
[*-master]: ${prefix}/${version}/write/delete -> ${base}/${version}/crud/delete
[*-master]: ${prefix}/${version}/write/bulk-write -> ${base}/${version}/crud/bulk-write
[*-master]: ${prefix}/${version}/write/replace -> ${base}/${version}/crud/replace
[*-master]: ${prefix}/${version}/write/transactions -> ${base}/${version}/crud/transactions
[*-master]: ${prefix}/${version}/read/specify-a-query -> ${base}/${version}/crud/query/specify-a-query
[*-master]: ${prefix}/${version}/read/retrieve -> ${base}/${version}/crud/query/find
[*-master]: ${prefix}/${version}/read/specify-documents-to-return -> ${base}/${version}/crud/query/specify-documents-to-return
[*-master]: ${prefix}/${version}/read/project -> ${base}/${version}/crud/query/project
[*-master]: ${prefix}/${version}/read/count -> ${base}/${version}/crud/query/count
[*-master]: ${prefix}/${version}/read/distinct -> ${base}/${version}/crud/query/distinct
[*-master]: ${prefix}/${version}/read/cursors -> ${base}/${version}/crud/query/cursors
[*-master]: ${prefix}/${version}/monitoring -> ${base}/${version}/logging-and-monitoring/monitoring
[*-master]: ${prefix}/${version}/read/change-streams -> ${base}/${version}/logging-and-monitoring/change-streams
[*-master]: ${prefix}/${version}/whats-new -> ${base}/${version}/reference/whats-new
[*-master]: ${prefix}/${version}/compatibility -> ${base}/${version}/reference/compatibility
[*-master]: ${prefix}/${version}/validate-signatures -> ${base}/${version}/security/validate-signatures
[*-master]: ${prefix}/${version}/agg-exp-ops -> ${base}/${version}/aggregation/agg-exp-ops
10 changes: 7 additions & 3 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ intersphinx = [
]

toc_landing_pages = [
"/write-operations",
"/read",
"/connect",
"/indexes",
"work-with-indexes",
"/work-with-indexes",
"/data-formats",
"/builders",
"/aggregation",
"/connect/connection-options",
"/logging-and-monitoring",
"/databases-and-collections",
"/security/authentication"
]

sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
Expand All @@ -36,3 +38,5 @@ kotlin-docs = "https://kotlinlang.org"
serialization-version = "1.6.0"
kotlinx-dt-version = "0.6.1"
mongocrypt-version = "{+full-version+}"
logbackVersion = "1.2.11"
log4j2Version = "2.17.1"
50 changes: 12 additions & 38 deletions source/aggregation.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _kotlin-sync-aggregation:

====================================
Transform Your Data with Aggregation
====================================
======================
Aggregation Operations
======================

.. facet::
:name: genre
Expand All @@ -18,9 +18,11 @@ Transform Your Data with Aggregation
:depth: 2
:class: singlecol

.. .. toctree::
.. :titlesonly:
.. :maxdepth: 1
.. toctree::
:titlesonly:
:maxdepth: 1

Aggregation Expressions </aggregation/agg-exp-ops>

.. /aggregation/aggregation-tutorials

Expand Down Expand Up @@ -200,38 +202,10 @@ an aggregation pipeline that contains one of the following pipeline stages:
- ``$search``
- ``$searchMeta``

To learn more about Atlas Search pipeline stages, see :atlas:`Choose the
Aggregation Pipeline Stage </atlas-search/query-syntax/>` in the Atlas
documentation.

Create a Pipeline Search Stage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can create the search criteria in your Atlas Search pipeline stage
by using Search operators.

.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst

.. replacement:: as-idx-link

the :ref:`kotlin-sync-atlas-search-index` guide

.. replacement:: atlas-query-operators-example

.. io-code-block::

.. input:: /includes/aggregation/aggregation.kt
:language: kotlin
:start-after: // start-atlas-searchoperator-helpers
:end-before: // end-atlas-searchoperator-helpers
:dedent:

.. output::
:language: console
:visible: false

Document{{_id=..., genres=[Comedy, Romance], title=Love at First Bite, year=1979}}
Document{{_id=..., genres=[Comedy, Drama], title=Love Affair, year=1994}}
To learn more about Atlas Search pipeline stages, see :atlas:`Choose the Aggregation
Pipeline Stage </atlas-search/query-syntax/>` in the Atlas documentation. To view
examples that use the {+driver-short+} to create Atlas Search pipeline search stages, see
the :ref:`kotlin-sync-atlas-search` guide.

Additional Information
----------------------
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions source/api.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. meta::
:robots: noindex, nosnippet

.. _kotlin-sync-api-docs:

=================
Expand Down
157 changes: 157 additions & 0 deletions source/atlas-search.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
.. _kotlin-sync-atlas-search:

=========================
Run an Atlas Search Query
=========================

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: full text, text analyzer, meta, pipeline, scoring, Lucene
:description: Learn about how to use Atlas Search in the {+driver-long+}.

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

Overview
--------

In this guide, you can learn how to use the {+driver-short+} to
run :atlas:`Atlas Search </atlas-search/>` queries on a collection.
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.

Sample Data
~~~~~~~~~~~

The examples in this guide use the ``movies`` collection in the ``sample_mflix``
database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to
create a free MongoDB Atlas cluster and load the sample datasets, see the
:atlas:`Get Started with Atlas </getting-started>` guide. To learn more about
aggregation operations and builders, see the :ref:`kotlin-sync-aggregation` guide.

Run an Atlas Search Query
-------------------------

This section shows how to create an aggregation pipeline to run an
Atlas Search query on a collection. You can use the ``Aggregates.search()`` builder
method to create a ``$search`` pipeline stage, which specifies the search
criteria. Then, call the ``aggregate()`` method and pass your pipeline as a
parameter.

.. note:: Only Available on Atlas for MongoDB v4.2 and later

This aggregation pipeline operator is only available for collections hosted
on :atlas:`MongoDB Atlas </>` clusters running v4.2 or later that are
covered by an :atlas:`Atlas Search index </reference/atlas-search/index-definitions/>`.
Learn more about the required setup and the functionality of this operator
from the :atlas:`Atlas Search </atlas-search/>` documentation.

Before running an Atlas Search query, you must create an Atlas Search index
on your collection. To learn how to programmatically create an Atlas Search
index, see the :ref:`kotlin-sync-atlas-search-index-create` section in the Indexes guide.

Atlas Search Example
~~~~~~~~~~~~~~~~~~~~

This example runs an Atlas Search query by performing the
following actions:

- Constructs a ``$search`` stage by using the ``Aggregates.search()`` builder method,
instructing the driver to query for documents in which the ``title``
field contains the word ``"Alabama"``

- Constructs a ``$project`` stage by using the ``Aggregates.project()`` builder method,
instructing the driver to include the ``title`` field in the query results

- Passes the pipeline stages to the ``aggregate()`` method and prints the results

.. io-code-block::
:copyable:

.. input:: /includes/atlas-search.kt
:start-after: begin-atlas-search
:end-before: end-atlas-search
:language: kotlin
:dedent:

.. output::
:language: console
:visible: false

{"_id": {"$oid": "..."}, "title": "Alabama Moon"}
{"_id": {"$oid": "..."}, "title": "Crazy in Alabama"}
{"_id": {"$oid": "..."}, "title": "Sweet Home Alabama"}

Atlas Search Metadata
---------------------

Use the ``searchMeta()`` method to create a :manual:`$searchMeta
</reference/operator/aggregation/searchMeta/>` pipeline stage, which returns
only the metadata from the Atlas full-text search results.

.. tip:: Only Available on Atlas for MongoDB v4.4.11 and later

This aggregation pipeline operator is available only
on :atlas:`MongoDB Atlas </>` clusters running v4.4.11 and later.

The following example shows the ``near`` metadata for an Atlas Search
aggregation stage:

.. literalinclude:: /includes/aggregation/search-meta-agg.kt
:start-after: // begin atlasSearchMeta
:end-before: // end atlasSearchMeta
:language: kotlin
:dedent:

.. _kotlin-atlas-search-helpers:

Create Pipeline Search Stages
-----------------------------

.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst

.. replacement:: as-idx-link

the :ref:`kotlin-sync-atlas-search-index-create` section of the Indexes guide

.. replacement:: atlas-query-operators-example

.. io-code-block::

.. input:: /includes/aggregation/aggregation.kt
:language: kotlin
:start-after: // start-atlas-searchoperator-helpers
:end-before: // end-atlas-searchoperator-helpers
:dedent:

.. output::
:language: console
:visible: false

{"_id": ..., "genres": ["Comedy", "Romance"], "title": "Love at First Bite", "year": 1979}
{"_id": ..., "genres": ["Comedy", "Drama"], "title": "Love Affair", "year": 1994}

Additional Information
----------------------

To learn more about Atlas Search, see :atlas:`Atlas Search </atlas-search/>`
in the Atlas documentation.

API Documentation
~~~~~~~~~~~~~~~~~

To learn more about the methods mentioned in this guide, see
the following API documentation:

- `aggregate() <{+driver-api+}/-mongo-collection/aggregate.html>`__
- `Aggregates.search() <{+core-api+}/client/model/Aggregates.html#search(com.mongodb.client.model.search.SearchCollector)>`__
- `Aggregates.searchMeta() <{+core-api+}/client/model/Aggregates.html#searchMeta(com.mongodb.client.model.search.SearchCollector)>`__
- `Aggregates.project() <{+core-api+}/client/model/Aggregates.html#project(org.bson.conversions.Bson)>`__
- `SearchOperator <{+core-api+}/client/model/search/SearchOperator.html>`__
Loading
Loading