Skip to content

Commit 7fb2249

Browse files
committed
array operators
1 parent 55deb20 commit 7fb2249

File tree

1 file changed

+90
-24
lines changed

1 file changed

+90
-24
lines changed

source/crud/query/specify-query.txt

Lines changed: 90 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -228,44 +228,110 @@ Array operators match documents based on the value or quantity of elements in an
228228
field. The following is a list of builder methods that use array operators:
229229

230230
.. list-table::
231-
:widths: 40 60
231+
:widths: 20 60 20
232232
:header-rows: 1
233233

234-
* - Operator
234+
* - {+driver-short+} Method
235235
- Description
236+
- {+mdb-server+} Operator
236237

237238
* - ``All()``
238-
- Matches documents where the array field contains all elements specified in
239-
the query.
239+
- Matches documents where the value of the field matches all values specified in the
240+
query.
241+
- :manual:`$all </reference/operator/query/all/>`
240242

241243
* - ``AnyEq()``
242-
- Matches documents where any element in the array field matches the specified
243-
query filter.
244+
- Matches documents where any element in the specified array field matches the specified
245+
query value.
246+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
244247

245248
* - ``AnyGt()``
246-
- Matches documents where any element in the array field is greater than the specified
247-
query filter.
249+
- Matches documents where any element in the specified array field is greater than the specified
250+
query value.
251+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
248252

249253
* - ``AnyGte()``
250-
- Matches documents where any element in the array field is greater than or equal to
251-
the specified query filter.
254+
- Matches documents where any element in the specified array field is greater than or equal to
255+
the specified query value.
256+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
252257

253258
* - ``AnyIn()``
254-
- Matches documents where any element in the array field is greater than or equal to
255-
the specified query filter.
256-
259+
- Matches documents where any element in the specified array field matches any value in
260+
the specified query array.
261+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
262+
263+
* - ``AnyLt()``
264+
- Matches documents where any element in the specified array field is less than the specified
265+
query value.
266+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
267+
268+
* - ``AnyLte()``
269+
- Matches documents where any element in the specified array field is less than or equal to
270+
the specified query value.
271+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
272+
273+
* - ``AnyNe()``
274+
- Matches documents where any element in the specified array field is not equal to
275+
the specified query value.
276+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
277+
278+
* - ``AnyNin()``
279+
- Matches documents where none of the elements in the specified array field match any of the
280+
values in the specified query array. This method also matches documents where the
281+
specified field doesn't exist.
282+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
283+
284+
* - ``AnyStringIn()``
285+
- Matches documents where any string element in the specified array field matches any
286+
string value in the specified query array.
287+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
288+
289+
* - ``AnyStringNin()``
290+
- Matches documents where none of the string elements in the specified array field
291+
matches any of the values in the specified query filter. This method also matches
292+
documents where the specified field doesn't exist.
293+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
294+
295+
* - ``ElemMatch()``
296+
- Matches documents where any element in the specified array field matches the
297+
specified query criteria.
298+
- :manual:`$elemMatch </reference/operator/query/elemMatch/>`
299+
300+
* - ``In()``
301+
- Matches documents where the value of the specified field matches any value in the
302+
specified query array.
303+
- :manual:`$in </reference/operator/query/in/>`
304+
257305
* - ``Size()``
258-
- Matches documents if the array field is a specified size.
259-
260-
.. note::
261-
262-
The ``Any()`` builder uses the ``$elemMatch`` query operator.
263-
264-
To learn more about the ``$elemMatch`` query selector, see
265-
:manual:`$elemMatch </reference/operator/query/elemMatch/#mongodb-query-op.-elemMatch>`.
266-
267-
For more information on the array operators, see the :manual:`Array
268-
Query Operators </reference/operator/query-array/>` page.
306+
- Matches documents where the specified array field is the specified size.
307+
- :manual:`$size </reference/operator/query/size/>`
308+
309+
* - ``SizeGt()``
310+
- Matches documents where the specified array field is larger than the specified size.
311+
- :manual:`$size </reference/operator/query/size/>`
312+
313+
* - ``SizeGte()``
314+
- Matches documents where the specified array field is larger than or equal to the specified size.
315+
- :manual:`$size </reference/operator/query/size/>`
316+
317+
* - ``SizeLt()``
318+
- Matches documents where the specified array field is smaller than the specified size.
319+
- :manual:`$size </reference/operator/query/size/>`
320+
321+
* - ``SizeLte()``
322+
- Matches documents where the array field is smaller than or equal to the specified size.
323+
- :manual:`$size </reference/operator/query/size/>`
324+
325+
* - ``StringIn()``
326+
- Matches documents where the string value of the specified field matches any string value in the
327+
specified query array.
328+
- :manual:`$in </reference/operator/query/in/>`
329+
330+
* - ``StringNin()``
331+
- Matches documents where the string value of the specified field matches none of the
332+
string values in the specified query array.
333+
the specified query filter.
334+
- :manual:`$in </reference/operator/query/in/>`
269335

270336
The following example uses builders to create a query filter that matches all
271337
documents that have 3 elements in the ``models`` field:

0 commit comments

Comments
 (0)