@@ -39,8 +39,8 @@ notation. To learn more about this notation, see `Infix notation
39
39
.. note::
40
40
41
41
This page provides a limited number of code
42
- examples to demonstrate this functionality. To view examples for all
43
- the builder classes, see the :ref:`kotlin-builders-landing` guides .
42
+ examples to demonstrate this functionality. To learn more about using
43
+ builder classes, see the :ref:`kotlin-sync-builders` guide .
44
44
45
45
Add {+language+} Extensions to Your Project
46
46
-------------------------------------
@@ -85,7 +85,7 @@ After you install the extensions dependency, you can use the extension
85
85
methods by importing classes and methods from the
86
86
``com.mongodb.kotlin.client.model`` path. You can mix usage of these methods and
87
87
the standard builder methods in the same application, as shown in the
88
- :ref:`kotlin-data-class-aggregates` example in this guide.
88
+ :ref:`kotlin-sync- data-class-aggregates` example in this guide.
89
89
90
90
Builders Examples
91
91
-----------------
@@ -99,10 +99,8 @@ package.
99
99
When you the extension builder class methods data
100
100
classes, the methods respect your data class annotations from the
101
101
``bson-kotlin`` and ``bson-kotlinx`` packages. To learn more about
102
- annotations, see the :ref:`fundamentals-data-class-annotations`
103
- section of the Document Data Format: Data Classes guide and the
104
- :ref:`kotlin-data-class-annotation` section in the {+language+}
105
- Serialization guide.
102
+ annotations, see the :ref:`kotlin-sync-data-class-annotations`
103
+ section of the Document Data Format: Data Classes guide.
106
104
107
105
Sample Data
108
106
~~~~~~~~~~~
@@ -112,17 +110,19 @@ collection that describe students at a school. Documents in the
112
110
``students`` collection are modeled by the following {+language+} data
113
111
class:
114
112
115
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.data-class.kt
116
- :language: kotlin
113
+ .. literalinclude:: /includes/builders/builders-data-class.kt
114
+ :language: kotlin
115
+ :start-after: start-data-class
116
+ :end-before: end-data-class
117
+ :dedent:
117
118
118
- .. _kotlin-data-class-filters:
119
+ .. _kotlin-sync- data-class-filters:
119
120
120
121
Filters
121
122
~~~~~~~
122
123
123
124
You can use helpers from the ``Filters`` builders class to query on data
124
- class properties. To learn more about this class, see the
125
- :ref:`filters-builders` guide.
125
+ class properties.
126
126
127
127
The following code shows different ways to use ``Filters`` extension
128
128
methods to perform queries on the ``Student`` data class:
@@ -132,17 +132,19 @@ methods to perform queries on the ``Student`` data class:
132
132
import com.mongodb.kotlin.client.model.Filters.eq
133
133
import com.mongodb.kotlin.client.model.Filters.all
134
134
135
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.filters -data-class.kt
135
+ .. literalinclude:: /includes/builders/builders -data-class.kt
136
136
:language: kotlin
137
+ :start-after: start-filters-data-class
138
+ :end-before: end-filters-data-class
139
+ :dedent:
137
140
138
- .. _kotlin-data-class-indexes:
141
+ .. _kotlin-sync- data-class-indexes:
139
142
140
143
Indexes
141
144
~~~~~~~
142
145
143
146
You can use helpers from the ``Indexes`` builders class to create
144
- indexes on data class properties. To learn more about this class, see the
145
- :ref:`indexes-builders` guide.
147
+ indexes on data class properties.
146
148
147
149
The following code shows different ways to use ``Indexes`` extension
148
150
methods to create indexes on the ``Student`` data class:
@@ -152,17 +154,19 @@ methods to create indexes on the ``Student`` data class:
152
154
import com.mongodb.kotlin.client.model.Indexes.ascending
153
155
import com.mongodb.kotlin.client.model.Indexes.descending
154
156
155
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.indexes -data-class.kt
157
+ .. literalinclude:: /includes/builders/builders -data-class.kt
156
158
:language: kotlin
159
+ :start-after: start-indexes-data-class
160
+ :end-before: end-indexes-data-class
161
+ :dedent:
157
162
158
- .. _kotlin-data-class-projections:
163
+ .. _kotlin-sync- data-class-projections:
159
164
160
165
Projections
161
166
~~~~~~~~~~~
162
167
163
168
You can use helpers from the ``Projections`` builders class to create
164
- projections for data class properties. To learn more about this class, see the
165
- :ref:`projections-builders` guide.
169
+ projections for data class properties.
166
170
167
171
The following code shows how to use ``Projections`` extension
168
172
methods to create a projection on the ``Student`` data class:
@@ -173,17 +177,19 @@ methods to create a projection on the ``Student`` data class:
173
177
import com.mongodb.kotlin.client.model.Projections.fields
174
178
import com.mongodb.kotlin.client.model.Projections.include
175
179
176
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.projections -data-class.kt
180
+ .. literalinclude:: /includes/builders/builders -data-class.kt
177
181
:language: kotlin
182
+ :start-after: start-proj-data-class
183
+ :end-before: end-proj-data-class
184
+ :dedent:
178
185
179
- .. _kotlin-data-class-sorts:
186
+ .. _kotlin-sync- data-class-sorts:
180
187
181
188
Sorts
182
189
~~~~~
183
190
184
191
You can use helpers from the ``Sorts`` builders class to sort
185
- on your data class properties. To learn more about this class, see the
186
- :ref:`sorts-builders` guide.
192
+ on your data class properties.
187
193
188
194
The following code shows how to use ``Sorts`` extension
189
195
methods to create different sorts on the ``Student`` data class:
@@ -193,17 +199,19 @@ methods to create different sorts on the ``Student`` data class:
193
199
import com.mongodb.client.model.Sorts.orderBy
194
200
import com.mongodb.kotlin.client.model.Sorts
195
201
196
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.sorts -data-class.kt
202
+ .. literalinclude:: /includes/builders/builders -data-class.kt
197
203
:language: kotlin
204
+ :start-after: start-sorts-data-class
205
+ :end-before: end-sorts-data-class
206
+ :dedent:
198
207
199
- .. _kotlin-data-class-updates:
208
+ .. _kotlin-sync- data-class-updates:
200
209
201
210
Updates
202
211
~~~~~~~
203
212
204
213
You can use helpers from the ``Updates`` builders class to perform
205
- updates by using your data class properties. To learn more about this
206
- class, see the :ref:`updates-builders` guide.
214
+ updates by using your data class properties.
207
215
208
216
The following code shows how to use ``Sorts`` extension
209
217
methods to create different sorts on the ``Student`` data class:
@@ -215,18 +223,20 @@ methods to create different sorts on the ``Student`` data class:
215
223
import com.mongodb.kotlin.client.model.Updates.combine
216
224
import com.mongodb.kotlin.client.model.Updates.max
217
225
218
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.updates -data-class.kt
226
+ .. literalinclude:: /includes/builders/builders -data-class.kt
219
227
:language: kotlin
228
+ :start-after: start-updates-data-class
229
+ :end-before: end-updates-data-class
230
+ :dedent:
220
231
221
- .. _kotlin-data-class-aggregates:
232
+ .. _kotlin-sync- data-class-aggregates:
222
233
223
234
Aggregates
224
235
~~~~~~~~~~
225
236
226
237
You can use helpers from the ``Aggregates`` and ``Accumulators``
227
238
builders classes to perform aggregations by using you data class
228
- properties. To learn more about these classes, see the
229
- :ref:`aggregates-builders` guide.
239
+ properties.
230
240
231
241
The following code shows how to use ``Accumulators`` extension
232
242
methods and ``Aggregates`` helper methods to perform an aggregation on
@@ -239,11 +249,14 @@ the ``Student`` data class:
239
249
import com.mongodb.client.model.Aggregates.sort
240
250
import com.mongodb.kotlin.client.model.Accumulators.avg
241
251
242
- .. literalinclude:: /examples/generated/BuildersDataClassTest.snippet.aggregates -data-class.kt
252
+ .. literalinclude:: /includes/builders/builders -data-class.kt
243
253
:language: kotlin
254
+ :start-after: start-agg-data-class
255
+ :end-before: end-agg-data-class
256
+ :dedent:
244
257
245
258
API Documentation
246
259
-----------------
247
260
248
261
- `{+driver-short+} Extensions
249
- <{+api+}/apidocs/mongodb-driver-kotlin-extensions/index.html>`__
262
+ <{+core- api+}/apidocs/mongodb-driver-kotlin-extensions/index.html>`__
0 commit comments