@@ -23,14 +23,14 @@ Query Documents
23
23
:backlinks: none
24
24
:depth: 1
25
25
26
- ----------
26
+ You can query documents in MongoDB by using the following
27
+ methods:
27
28
28
- .. |arrow| unicode :: U+27A4
29
+ .. |atlas-ref| replace :: :ref:`query-documents-atlas-ui`
29
30
30
- |arrow| Use the **Select your language** drop-down menu in the
31
- upper-right to set the language of the following examples.
31
+ .. include:: /includes/fact-methods.rst
32
32
33
- ----------
33
+ .. include:: /includes/language-selector-instructions.rst
34
34
35
35
.. tabs-selector:: drivers
36
36
@@ -255,6 +255,40 @@ which corresponds to the following SQL statement:
255
255
MongoDB supports regular expressions :query:`$regex` queries to
256
256
perform string pattern matches.
257
257
258
+ .. _query-documents-atlas-ui:
259
+
260
+ Query Documents with {+atlas+}
261
+ ------------------------------------------
262
+
263
+ The example in this section uses the :atlas:`sample movies dataset
264
+ </sample-data/sample-mflix/>`. To learn how to load the sample dataset
265
+ into your {+atlas+} deployment, see :atlas:`Load Sample Data
266
+ </sample-data/#std-label-load-sample-data>`.
267
+
268
+ To project fields to return from a query in {+atlas+}, follow these
269
+ steps:
270
+
271
+ .. procedure::
272
+ :style: normal
273
+
274
+ .. step:: Navigate to the collection
275
+
276
+ .. include:: /includes/steps-nav-atlas-sample-movies.rst
277
+
278
+ .. step:: Specify the :guilabel:`Filter` field
279
+
280
+ .. include:: /includes/steps-specify-query-filter.rst
281
+
282
+ .. code-block:: javascript
283
+
284
+ { year: 1924 }
285
+
286
+ .. step:: Click :guilabel:`Apply`
287
+
288
+ This query filter returns all documents
289
+ in the ``sample_mflix.movies`` collection where the ``year``
290
+ field matches ``1924``.
291
+
258
292
Additional Query Tutorials
259
293
--------------------------
260
294
@@ -385,15 +419,15 @@ To learn how to iterate through documents in a cursor, refer to your
385
419
:driver:`driver's documentation </>`. If you are using ``mongosh``, see
386
420
:ref:`read-operations-cursors`.
387
421
422
+ Additional Methods and Options
423
+ ------------------------------
424
+
388
425
.. tabs-drivers::
389
426
390
427
tabs:
391
428
- id: shell
392
429
content: |
393
430
394
- Additional Methods
395
- ------------------
396
-
397
431
The following methods can also read documents from a collection:
398
432
399
433
- :method:`db.collection.findOne`
@@ -411,9 +445,6 @@ To learn how to iterate through documents in a cursor, refer to your
411
445
- id: compass
412
446
content: |
413
447
414
- Additional Options
415
- ------------------
416
-
417
448
In addition to ``filter``, MongoDB Compass also allows the
418
449
following options to be passed to the query bar:
419
450
@@ -439,9 +470,6 @@ To learn how to iterate through documents in a cursor, refer to your
439
470
- id: python
440
471
content: |
441
472
442
- Additional Methods
443
- ------------------
444
-
445
473
The following methods can also read documents from a collection:
446
474
447
475
- :py:meth:`pymongo.collection.Collection.find_one`
@@ -461,9 +489,6 @@ To learn how to iterate through documents in a cursor, refer to your
461
489
- id: java-sync
462
490
content: |
463
491
464
- Additional Methods
465
- ------------------
466
-
467
492
The following methods can also read documents from a collection:
468
493
469
494
- In the :ref:`aggregation pipeline <aggregation-pipeline>`,
@@ -474,9 +499,6 @@ To learn how to iterate through documents in a cursor, refer to your
474
499
- id: java-async
475
500
content: |
476
501
477
- Additional Methods
478
- ------------------
479
-
480
502
The following methods can also read documents from a collection:
481
503
482
504
- In :ref:`aggregation pipeline <aggregation-pipeline>`,
@@ -488,9 +510,6 @@ To learn how to iterate through documents in a cursor, refer to your
488
510
- id: nodejs
489
511
content: |
490
512
491
- Additional Methods
492
- ------------------
493
-
494
513
The following methods can also read documents from a collection:
495
514
496
515
- :node-api:`Collection.findOne() <Collection.html#findOne>`
@@ -512,9 +531,6 @@ To learn how to iterate through documents in a cursor, refer to your
512
531
- id: php
513
532
content: |
514
533
515
- Additional Methods
516
- ------------------
517
-
518
534
The following methods can also read documents from a collection:
519
535
520
536
- :phpmethod:`MongoDB\\Collection::findOne() <phpmethod.MongoDB\\Collection::findOne>`
@@ -536,9 +552,6 @@ To learn how to iterate through documents in a cursor, refer to your
536
552
- id: perl
537
553
content: |
538
554
539
- Additional Methods
540
- ------------------
541
-
542
555
The following methods can also read documents from a collection:
543
556
544
557
- :perl-api:`MongoDB::Collection::find_one()<Collection#find_one>`
@@ -560,9 +573,6 @@ To learn how to iterate through documents in a cursor, refer to your
560
573
- id: ruby
561
574
content: |
562
575
563
- Additional Methods
564
- ------------------
565
-
566
576
The following methods can also read documents from a collection:
567
577
568
578
- In :ref:`aggregation pipeline <aggregation-pipeline>`, the
@@ -573,9 +583,6 @@ To learn how to iterate through documents in a cursor, refer to your
573
583
- id: scala
574
584
content: |
575
585
576
- Additional Methods
577
- ------------------
578
-
579
586
The following methods can also read documents from a collection:
580
587
581
588
- In :ref:`aggregation pipeline <aggregation-pipeline>`, the
@@ -585,9 +592,6 @@ To learn how to iterate through documents in a cursor, refer to your
585
592
- id: csharp
586
593
content: |
587
594
588
- Additional Methods
589
- ------------------
590
-
591
595
The following methods can also read documents from a collection:
592
596
593
597
- :csharp-api:`MongoCollection.FindOne() <M_MongoDB_Driver_MongoCollection_1_FindOne_1>`
@@ -609,9 +613,6 @@ To learn how to iterate through documents in a cursor, refer to your
609
613
- id: go
610
614
content: |
611
615
612
- Additional Methods
613
- ------------------
614
-
615
616
The following methods can also read documents from a collection:
616
617
617
618
- :go-api:`Collection.FindOne <mongo#Collection.FindOne>`
0 commit comments