@@ -142,61 +142,63 @@ content: |
142
142
143
143
* - ``<field>: <1 or true>``
144
144
145
- - Specifies the inclusion of a field. Non-zero integers are also
146
- treated as ``true``.
145
+ - Specifies the inclusion of a field. If you specify a non-zero
146
+ integer for the projection value, the operation treats the
147
+ value as ``true``.
147
148
148
149
* - ``<field>: <0 or false>``
149
150
150
151
- Specifies the exclusion of a field.
151
152
152
153
* - ``"<field>.$": <1 or true>``
153
154
154
- - With the use of the :projection:`$` array projection operator,
155
- you can specify the projection to return the **first** element
156
- that match the query condition on the array field; e.g.
157
- ``"arrayField.$" : 1``. (Not available for :doc:`views
158
- </core/views>`.) Non-zero integers are also treated as
159
- ``true` `.
155
+ - Uses the :projection:`$` array projection operator to return
156
+ the first element that matches the query condition on the
157
+ array field. If you specify a non-zero integer for the
158
+ projection value, the operation treats the value as ``true``.
159
+
160
+ Not available for :ref:`views <views-landing-page> `.
160
161
161
162
* - ``<field>: <array projection>``
162
163
163
- - Using the array projection operators :projection:`$elemMatch`,
164
- :projection:`$slice`, specifies the array element(s) to include,
165
- thereby excluding those elements that do not meet the
166
- expressions. (Not available for :doc:`views </core/views>`.)
164
+ - Uses the array projection operators (:projection:`$elemMatch`,
165
+ :projection:`$slice`) to specify the array elements to
166
+ include.
167
+
168
+ Not available for :ref:`views <views-landing-page>`.
167
169
168
170
* - ``<field>: <$meta expression>``
169
171
170
- - Using the :expression:`$meta` operator expression, specifies the
171
- inclusion of available :expression:`per-document metadata
172
- <$meta>`. (Not available for :doc:`views </core/views>`.)
172
+ - Uses the :expression:`$meta` operator expression to specify
173
+ the inclusion of available :expression:`per-document metadata
174
+ <$meta>`.
175
+
176
+ Not available for :ref:`views <views-landing-page>`.
173
177
174
178
175
179
* - ``<field>: <aggregation expression>``
176
180
177
181
- Specifies the value of the projected field.
178
182
179
183
Starting in MongoDB 4.4, with the use of :ref:`aggregation
180
- expressions and syntax <aggregation-expressions>`, including the
181
- use of literals and aggregation variables, you can project new
182
- fields or project existing fields with new values. For example,
184
+ expressions and syntax <aggregation-expressions>`, including
185
+ the use of literals and aggregation variables, you can project
186
+ new fields or project existing fields with new values.
183
187
184
188
- If you specify a non-numeric, non-boolean literal (such as a
185
- literal string or an array or an operator expression) for the
186
- projection value, the field is projected with the new value;
187
- e.g. :
189
+ literal string or an array or an operator expression) for
190
+ the projection value, the field is projected with the new
191
+ value, for example :
188
192
189
193
- ``{ field: [ 1, 2, 3, "$someExistingField" ] }``
190
194
- ``{ field: "New String Value" }``
191
195
- ``{ field: { status: "Active", total: { $sum: "$existingArray" } } }``
192
196
193
- - To project a literal value for a field, use the :expression:`$literal`
194
- aggregation expression; e.g. :
197
+ - To project a literal value for a field, use the
198
+ :expression:`$literal` aggregation expression; for example :
195
199
196
200
- ``{ field: { $literal: 5 } }``
197
-
198
201
- ``{ field: { $literal: true } }``
199
-
200
202
- ``{ field: { $literal: { fieldWithValue0: 0, fieldWithValue1: 1 } } }``
201
203
202
204
In versions 4.2 and earlier, any specification value (with
@@ -219,28 +221,30 @@ content: |
219
221
220
222
* - ``<field>: <1 or true>``
221
223
222
- - Specifies the inclusion of a field. Non-zero integers are also
223
- treated as ``true``.
224
+ - Specifies the inclusion of a field. If you specify a non-zero
225
+ integer for the projection value, the operation treats the
226
+ value as ``true``.
224
227
225
228
* - ``<field>: <0 or false>``
226
229
227
230
- Specifies the exclusion of a field.
228
231
229
232
* - ``"<field>.$": <1 or true>``
230
233
231
- - With the use of the :projection:`$` array projection operator,
232
- you can specify the projection to return the **first** element
233
- that match the query condition on the array field; e.g.
234
- ``"arrayField.$" : 1``. (Not available for :doc:`views
235
- </core/views>`.) Non-zero integers are also treated as
236
- ``true` `.
234
+ - Uses the :projection:`$` array projection operator to return
235
+ the first element that matches the query condition on the
236
+ array field. If you specify a non-zero integer for the
237
+ projection value, the operation treats the value as ``true``.
238
+
239
+ Not available for :ref:`views <views-landing-page> `.
237
240
238
241
* - ``<field>: <array projection>``
239
242
240
- - Using the array projection operators :projection:`$elemMatch`,
241
- :projection:`$slice`, specifies the array element(s) to include,
242
- thereby excluding those elements that do not meet the
243
- expressions. (Not available for :doc:`views </core/views>`.)
243
+ - Uses the array projection operators (:projection:`$elemMatch`,
244
+ :projection:`$slice`) to specify the array elements to
245
+ include.
246
+
247
+ Not available for :ref:`views <views-landing-page>`.
244
248
245
249
* - ``<field>: <aggregation expression>``
246
250
@@ -249,24 +253,22 @@ content: |
249
253
Starting in MongoDB 4.4, with the use of :ref:`aggregation
250
254
expressions and syntax <aggregation-expressions>`, including the
251
255
use of literals and aggregation variables, you can project new
252
- fields or project existing fields with new values. For example,
256
+ fields or project existing fields with new values.
253
257
254
258
- If you specify a non-numeric, non-boolean literal (such as a
255
- literal string or an array or an operator expression) for the
256
- projection value, the field is projected with the new value;
257
- e.g. :
259
+ literal string or an array or an operator expression) for
260
+ the projection value, the field is projected with the new
261
+ value, for example :
258
262
259
263
- ``{ field: [ 1, 2, 3, "$someExistingField" ] }``
260
264
- ``{ field: "New String Value" }``
261
265
- ``{ field: { status: "Active", total: { $sum: "$existingArray" } } }``
262
266
263
- - To project a literal value for a field, use the :expression:`$literal`
264
- aggregation expression; e.g. :
267
+ - To project a literal value for a field, use the
268
+ :expression:`$literal` aggregation expression, for example :
265
269
266
270
- ``{ field: { $literal: 5 } }``
267
-
268
271
- ``{ field: { $literal: true } }``
269
-
270
272
- ``{ field: { $literal: { fieldWithValue0: 0, fieldWithValue1: 1 } } }``
271
273
272
274
In versions 4.2 and earlier, any specification value (with
@@ -282,9 +284,9 @@ content: |
282
284
For fields in an embedded documents, you can specify the field using
283
285
either:
284
286
285
- - :ref:`dot notation <document-dot-notation-embedded-fields>`; e.g. ``"field.nestedfield": <value>``
287
+ - :ref:`dot notation <document-dot-notation-embedded-fields>`, for example ``"field.nestedfield": <value>``
286
288
287
- - nested form; e.g. ``{ field: { nestedfield: <value> } }`` (*Starting in
289
+ - nested form, for example ``{ field: { nestedfield: <value> } }`` (*Starting in
288
290
MongoDB 4.4*)
289
291
290
292
---
@@ -364,7 +366,7 @@ ref: projection-positional-operator-path
364
366
content : |
365
367
366
368
Starting in MongoDB 4.4, the :projection:`$` projection operator can
367
- only appear at the end of the field path; e.g. ``"field.$"``
369
+ only appear at the end of the field path, for example ``"field.$"``
368
370
or ``"fieldA.fieldB.$"``.
369
371
370
372
For example, starting in MongoDB 4.4, the following operation is
0 commit comments