Skip to content

Commit e22c41a

Browse files
norareidyshuangelamcmorisianabellabuckvar
authored
DOCSP-51319: Kotlin comprehensive coverage (#13874) (#13901)
* DOCSP-51351-reorganize-toc (#106) * reorg toc * Empty-Commit * fix links * fix link * Fix build errors * nr feedback * align with toc spreadsheet * fix quick bugs * add db coll section * fix file * fix typo * nr feedback * DOCSP-51320: Document causal consistency (#108) * add logging overview (#112) * DOCSP-51345: Document polling SRV records (#107) * DOCSP-51326-add-find-one (#114) * add find one * fix code * edit code * add table entries * formatting * monospace * mw feedback * DOCSP-51408-connection-troubleshooting (#109) * connection troubleshooting: * fix typos/broken links * lm feedback * fix toc * fix toc again * attempt error fix * Fix toc * Fix build error * DOCSP-51323: Databases & collections (#111) * DOCSP-51323: Databases & collections * code fix * edits * link fix * NH feedback * DOCSP-51341: Extended JSON (#116) * DOCSP-51341: Extended JSON * snooty * edits * build errors * NH feedback * DOCSP-51324: Network Compression (#110) * DOCSP-51350: Vector search queries (#117) * DOCSP-51350: Vector search queries * edit * NX feedback * edits * word * DOCSP-51321: Configure CRUD operations (#113) * DOCSP-51321: Configure CRUD operations * keywords * MW feedback * DOCSP-51327-add-upsert (#121) * change title * edit title size * DOCSP-51407: Auth reorganization (#120) * DOCSP-51407: Auth reorganization * edit * toc * titles * MW feedback * vale * DOCSP-51283: noindex short pages (#124) * DOCSP-52259-edit-aggregation-page (#123) * remove duplicate info from aggregation guide * nr feedback * remove extra space * update credentials (#125) * DOCSP-51348-atlas-search-page (#122) * atlas search page * fix link * sa feedback * nathan feedback * DOCSP-51349: Upgrade guide (#127) * DOCSP-51349: Upgrade guide * edits * edits * DOCSP-51347: Server Selection (#118) * DOCSP-51344: Logging (#115) * DOCSP-51889-retryable-reads-and-writes (#126) * add retryable section * mb feedback * DOCSP-51325: Connection pools (#119) * DOCSP-51325: Connection pools * edits * edits * keywords * link * imports * code edit * move file * DOCSP-52970: Extension library info (#13817) * DOCSP-52970: Extension library info * edits * fixes * DOCSP-51438: Indexes page reorg (#13797) * DOCSP-51438: Indexes page reorg (#13797) (#13843) * Delete unused files (#13845) * DOCSP-51596: CC cleanup (#13838) * DOCSP-51596: Titles cleanup * edits * fix auth, remove files * fix * title edits * build errors, delete more files * sharedinclude replacements * edit * redirects * edits * RM feedback * gridfs --------- Co-authored-by: shuangela <[email protected]> Co-authored-by: Michael Morisi <[email protected]> Co-authored-by: anabellabuckvar <[email protected]>
1 parent d9f6a22 commit e22c41a

File tree

84 files changed

+4995
-2022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4995
-2022
lines changed

content/kotlin-sync/upcoming/snooty.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ intersphinx = [
88
]
99

1010
toc_landing_pages = [
11-
"/write-operations",
12-
"/read",
1311
"/connect",
1412
"/indexes",
15-
"work-with-indexes",
1613
"/data-formats",
1714
"/builders",
1815
"/aggregation",
16+
"/connect/connection-options",
17+
"/logging-and-monitoring",
18+
"/databases-and-collections",
19+
"/security/authentication"
1920
]
2021

2122
sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
@@ -36,3 +37,5 @@ kotlin-docs = "https://kotlinlang.org"
3637
serialization-version = "1.6.0"
3738
kotlinx-dt-version = "0.6.1"
3839
mongocrypt-version = "{+full-version+}"
40+
logbackVersion = "1.2.11"
41+
log4j2Version = "2.17.1"

content/kotlin-sync/upcoming/source/aggregation.txt

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _kotlin-sync-aggregation:
22

3-
====================================
4-
Transform Your Data with Aggregation
5-
====================================
3+
======================
4+
Aggregation Operations
5+
======================
66

77
.. facet::
88
:name: genre
@@ -18,11 +18,11 @@ Transform Your Data with Aggregation
1818
:depth: 2
1919
:class: singlecol
2020

21-
.. .. toctree::
22-
.. :titlesonly:
23-
.. :maxdepth: 1
21+
.. toctree::
22+
:titlesonly:
23+
:maxdepth: 1
2424

25-
.. /aggregation/aggregation-tutorials
25+
Aggregation Expressions </aggregation/agg-exp-ops>
2626

2727
Overview
2828
--------
@@ -114,13 +114,11 @@ following stages:
114114
documents by the ``borough`` field, producing a count of documents for each distinct
115115
value of that field.
116116

117-
.. TODO: uncomment when Aggregates Builder page is created
117+
.. note::
118118

119-
.. .. note::
120-
121-
.. The following example uses the builders pattern to implement the stages of an
122-
.. aggregation pipeline. To learn more about how to use the builders pattern, see
123-
.. :ref:`<aggregates-builders>`
119+
The following example uses the builders pattern to implement the stages of an
120+
aggregation pipeline. To learn more about how to use the builders pattern, see
121+
:ref:`<kotlin-sync-builders-data-classes>`
124122

125123
.. io-code-block::
126124

@@ -200,38 +198,10 @@ an aggregation pipeline that contains one of the following pipeline stages:
200198
- ``$search``
201199
- ``$searchMeta``
202200

203-
To learn more about Atlas Search pipeline stages, see :atlas:`Choose the
204-
Aggregation Pipeline Stage </atlas-search/query-syntax/>` in the Atlas
205-
documentation.
206-
207-
Create a Pipeline Search Stage
208-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209-
210-
You can create the search criteria in your Atlas Search pipeline stage
211-
by using Search operators.
212-
213-
.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
214-
215-
.. replacement:: as-idx-link
216-
217-
the :ref:`kotlin-sync-atlas-search-index` guide
218-
219-
.. replacement:: atlas-query-operators-example
220-
221-
.. io-code-block::
222-
223-
.. input:: /includes/aggregation/aggregation.kt
224-
:language: kotlin
225-
:start-after: // start-atlas-searchoperator-helpers
226-
:end-before: // end-atlas-searchoperator-helpers
227-
:dedent:
228-
229-
.. output::
230-
:language: console
231-
:visible: false
232-
233-
Document{{_id=..., genres=[Comedy, Romance], title=Love at First Bite, year=1979}}
234-
Document{{_id=..., genres=[Comedy, Drama], title=Love Affair, year=1994}}
201+
To learn more about Atlas Search pipeline stages, see :atlas:`Choose the Aggregation
202+
Pipeline Stage </atlas-search/query-syntax/>` in the Atlas documentation. To view
203+
examples that use the {+driver-short+} to create Atlas Search pipeline search stages, see
204+
the :ref:`kotlin-sync-atlas-search` guide.
235205

236206
Additional Information
237207
----------------------

content/kotlin-sync/upcoming/source/agg-exp-ops.txt renamed to content/kotlin-sync/upcoming/source/aggregation/agg-exp-ops.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,4 +1177,4 @@ the Query API:
11771177
then: "$rating",
11781178
else: 1
11791179
} }
1180-
} } ]
1180+
} } ]

content/kotlin-sync/upcoming/source/api.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. meta::
2+
:robots: noindex, nosnippet
3+
14
.. _kotlin-sync-api-docs:
25

36
=================
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
.. _kotlin-sync-atlas-search:
2+
3+
=========================
4+
Run an Atlas Search Query
5+
=========================
6+
7+
.. facet::
8+
:name: genre
9+
:values: reference
10+
11+
.. meta::
12+
:keywords: full text, text analyzer, meta, pipeline, scoring, Lucene
13+
:description: Learn about how to use Atlas Search in the {+driver-long+}.
14+
15+
.. contents:: On this page
16+
:local:
17+
:backlinks: none
18+
:depth: 2
19+
:class: singlecol
20+
21+
Overview
22+
--------
23+
24+
In this guide, you can learn how to use the {+driver-short+} to
25+
run :atlas:`Atlas Search </atlas-search/>` queries on a collection.
26+
Atlas Search enables you to perform full-text searches on collections
27+
hosted on MongoDB Atlas. Atlas Search indexes specify the behavior of the
28+
search and which fields to index.
29+
30+
Sample Data
31+
~~~~~~~~~~~
32+
33+
The examples in this guide use the ``movies`` collection in the ``sample_mflix``
34+
database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to
35+
create a free MongoDB Atlas cluster and load the sample datasets, see the
36+
:atlas:`Get Started with Atlas </getting-started>` guide. To learn more about
37+
aggregation operations and builders, see the :ref:`kotlin-sync-aggregation` guide.
38+
39+
Run an Atlas Search Query
40+
-------------------------
41+
42+
This section shows how to create an aggregation pipeline to run an
43+
Atlas Search query on a collection. You can use the ``Aggregates.search()`` builder
44+
method to create a ``$search`` pipeline stage, which specifies the search
45+
criteria. Then, call the ``aggregate()`` method and pass your pipeline as a
46+
parameter.
47+
48+
.. note:: Only Available on Atlas for MongoDB v4.2 and later
49+
50+
This aggregation pipeline operator is only available for collections hosted
51+
on :atlas:`MongoDB Atlas </>` clusters running v4.2 or later that are
52+
covered by an :atlas:`Atlas Search index </reference/atlas-search/index-definitions/>`.
53+
Learn more about the required setup and the functionality of this operator
54+
from the :atlas:`Atlas Search </atlas-search/>` documentation.
55+
56+
Before running an Atlas Search query, you must create an Atlas Search index
57+
on your collection. To learn how to programmatically create an Atlas Search
58+
index, see the :ref:`kotlin-sync-atlas-search-index-create` section in the Indexes guide.
59+
60+
Atlas Search Example
61+
~~~~~~~~~~~~~~~~~~~~
62+
63+
This example runs an Atlas Search query by performing the
64+
following actions:
65+
66+
- Constructs a ``$search`` stage by using the ``Aggregates.search()`` builder method,
67+
instructing the driver to query for documents in which the ``title``
68+
field contains the word ``"Alabama"``
69+
70+
- Constructs a ``$project`` stage by using the ``Aggregates.project()`` builder method,
71+
instructing the driver to include the ``title`` field in the query results
72+
73+
- Passes the pipeline stages to the ``aggregate()`` method and prints the results
74+
75+
.. io-code-block::
76+
:copyable:
77+
78+
.. input:: /includes/atlas-search.kt
79+
:start-after: begin-atlas-search
80+
:end-before: end-atlas-search
81+
:language: kotlin
82+
:dedent:
83+
84+
.. output::
85+
:language: console
86+
:visible: false
87+
88+
{"_id": {"$oid": "..."}, "title": "Alabama Moon"}
89+
{"_id": {"$oid": "..."}, "title": "Crazy in Alabama"}
90+
{"_id": {"$oid": "..."}, "title": "Sweet Home Alabama"}
91+
92+
Atlas Search Metadata
93+
---------------------
94+
95+
Use the ``searchMeta()`` method to create a :manual:`$searchMeta
96+
</reference/operator/aggregation/searchMeta/>` pipeline stage, which returns
97+
only the metadata from the Atlas full-text search results.
98+
99+
.. tip:: Only Available on Atlas for MongoDB v4.4.11 and later
100+
101+
This aggregation pipeline operator is available only
102+
on :atlas:`MongoDB Atlas </>` clusters running v4.4.11 and later.
103+
104+
The following example shows the ``near`` metadata for an Atlas Search
105+
aggregation stage:
106+
107+
.. literalinclude:: /includes/aggregation/search-meta-agg.kt
108+
:start-after: // begin atlasSearchMeta
109+
:end-before: // end atlasSearchMeta
110+
:language: kotlin
111+
:dedent:
112+
113+
.. _kotlin-atlas-search-helpers:
114+
115+
Create Pipeline Search Stages
116+
-----------------------------
117+
118+
.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
119+
120+
.. replacement:: as-idx-link
121+
122+
the :ref:`kotlin-sync-atlas-search-index-create` section of the Indexes guide
123+
124+
.. replacement:: atlas-query-operators-example
125+
126+
.. io-code-block::
127+
128+
.. input:: /includes/aggregation/aggregation.kt
129+
:language: kotlin
130+
:start-after: // start-atlas-searchoperator-helpers
131+
:end-before: // end-atlas-searchoperator-helpers
132+
:dedent:
133+
134+
.. output::
135+
:language: console
136+
:visible: false
137+
138+
{"_id": ..., "genres": ["Comedy", "Romance"], "title": "Love at First Bite", "year": 1979}
139+
{"_id": ..., "genres": ["Comedy", "Drama"], "title": "Love Affair", "year": 1994}
140+
141+
Additional Information
142+
----------------------
143+
144+
To learn more about Atlas Search, see :atlas:`Atlas Search </atlas-search/>`
145+
in the Atlas documentation.
146+
147+
API Documentation
148+
~~~~~~~~~~~~~~~~~
149+
150+
To learn more about the methods mentioned in this guide, see
151+
the following API documentation:
152+
153+
- `aggregate() <{+driver-api+}/-mongo-collection/aggregate.html>`__
154+
- `Aggregates.search() <{+core-api+}/client/model/Aggregates.html#search(com.mongodb.client.model.search.SearchCollector)>`__
155+
- `Aggregates.searchMeta() <{+core-api+}/client/model/Aggregates.html#searchMeta(com.mongodb.client.model.search.SearchCollector)>`__
156+
- `Aggregates.project() <{+core-api+}/client/model/Aggregates.html#project(org.bson.conversions.Bson)>`__
157+
- `SearchOperator <{+core-api+}/client/model/search/SearchOperator.html>`__

0 commit comments

Comments
 (0)