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