@@ -19,14 +19,14 @@ Query Documents
19
19
:backlinks: none
20
20
:depth: 1
21
21
22
- ----------
22
+ You can query documents in MongoDB by using the following
23
+ methods:
23
24
24
- .. |arrow| unicode :: U+27A4
25
+ .. |atlas-ref| replace :: :ref:`query-documents-atlas-ui`
25
26
26
- |arrow| Use the **Select your language** drop-down menu in the
27
- upper-right to set the language of the following examples.
27
+ .. include:: /includes/fact-methods.rst
28
28
29
- ----------
29
+ .. include:: /includes/language-selector-instructions.rst
30
30
31
31
.. tabs-selector:: drivers
32
32
@@ -251,6 +251,40 @@ which corresponds to the following SQL statement:
251
251
MongoDB supports regular expressions :query:`$regex` queries to
252
252
perform string pattern matches.
253
253
254
+ .. _query-documents-atlas-ui:
255
+
256
+ Query Documents with {+atlas+}
257
+ ------------------------------------------
258
+
259
+ The example in this section uses the :atlas:`sample movies dataset
260
+ </sample-data/sample-mflix/>`. To learn how to load the sample dataset
261
+ into your {+atlas+} deployment, see :atlas:`Load Sample Data
262
+ </sample-data/#std-label-load-sample-data>`.
263
+
264
+ To project fields to return from a query in {+atlas+}, follow these
265
+ steps:
266
+
267
+ .. procedure::
268
+ :style: normal
269
+
270
+ .. step:: Navigate to the collection
271
+
272
+ .. include:: /includes/steps-nav-atlas-sample-movies.rst
273
+
274
+ .. step:: Specify the :guilabel:`Filter` field
275
+
276
+ .. include:: /includes/steps-specify-query-filter.rst
277
+
278
+ .. code-block:: javascript
279
+
280
+ { year: 1924 }
281
+
282
+ .. step:: Click :guilabel:`Apply`
283
+
284
+ This query filter returns all documents
285
+ in the ``sample_mflix.movies`` collection where the ``year``
286
+ field matches ``1924``.
287
+
254
288
Additional Query Tutorials
255
289
--------------------------
256
290
@@ -381,15 +415,15 @@ To learn how to iterate through documents in a cursor, refer to your
381
415
:driver:`driver's documentation </>`. If you are using ``mongosh``, see
382
416
:ref:`read-operations-cursors`.
383
417
418
+ Additional Methods and Options
419
+ ------------------------------
420
+
384
421
.. tabs-drivers::
385
422
386
423
tabs:
387
424
- id: shell
388
425
content: |
389
426
390
- Additional Methods
391
- ------------------
392
-
393
427
The following methods can also read documents from a collection:
394
428
395
429
- :method:`db.collection.findOne`
@@ -407,9 +441,6 @@ To learn how to iterate through documents in a cursor, refer to your
407
441
- id: compass
408
442
content: |
409
443
410
- Additional Options
411
- ------------------
412
-
413
444
In addition to ``filter``, MongoDB Compass also allows the
414
445
following options to be passed to the query bar:
415
446
@@ -435,9 +466,6 @@ To learn how to iterate through documents in a cursor, refer to your
435
466
- id: python
436
467
content: |
437
468
438
- Additional Methods
439
- ------------------
440
-
441
469
The following methods can also read documents from a collection:
442
470
443
471
- :py:meth:`pymongo.collection.Collection.find_one`
@@ -457,9 +485,6 @@ To learn how to iterate through documents in a cursor, refer to your
457
485
- id: java-sync
458
486
content: |
459
487
460
- Additional Methods
461
- ------------------
462
-
463
488
The following methods can also read documents from a collection:
464
489
465
490
- In the :doc:`aggregation pipeline </core/aggregation-pipeline>`,
@@ -470,9 +495,6 @@ To learn how to iterate through documents in a cursor, refer to your
470
495
- id: java-async
471
496
content: |
472
497
473
- Additional Methods
474
- ------------------
475
-
476
498
The following methods can also read documents from a collection:
477
499
478
500
- In :doc:`aggregation pipeline </core/aggregation-pipeline>`,
@@ -484,9 +506,6 @@ To learn how to iterate through documents in a cursor, refer to your
484
506
- id: nodejs
485
507
content: |
486
508
487
- Additional Methods
488
- ------------------
489
-
490
509
The following methods can also read documents from a collection:
491
510
492
511
- :node-api:`Collection.findOne() <Collection.html#findOne>`
@@ -508,9 +527,6 @@ To learn how to iterate through documents in a cursor, refer to your
508
527
- id: php
509
528
content: |
510
529
511
- Additional Methods
512
- ------------------
513
-
514
530
The following methods can also read documents from a collection:
515
531
516
532
- :phpmethod:`MongoDB\\Collection::findOne() <phpmethod.MongoDB\\Collection::findOne>`
@@ -532,9 +548,6 @@ To learn how to iterate through documents in a cursor, refer to your
532
548
- id: perl
533
549
content: |
534
550
535
- Additional Methods
536
- ------------------
537
-
538
551
The following methods can also read documents from a collection:
539
552
540
553
- :perl-api:`MongoDB::Collection::find_one()<Collection#find_one>`
@@ -556,9 +569,6 @@ To learn how to iterate through documents in a cursor, refer to your
556
569
- id: ruby
557
570
content: |
558
571
559
- Additional Methods
560
- ------------------
561
-
562
572
The following methods can also read documents from a collection:
563
573
564
574
- In :doc:`aggregation pipeline </core/aggregation-pipeline>`, the
@@ -569,9 +579,6 @@ To learn how to iterate through documents in a cursor, refer to your
569
579
- id: scala
570
580
content: |
571
581
572
- Additional Methods
573
- ------------------
574
-
575
582
The following methods can also read documents from a collection:
576
583
577
584
- In :doc:`aggregation pipeline </core/aggregation-pipeline>`, the
@@ -581,9 +588,6 @@ To learn how to iterate through documents in a cursor, refer to your
581
588
- id: csharp
582
589
content: |
583
590
584
- Additional Methods
585
- ------------------
586
-
587
591
The following methods can also read documents from a collection:
588
592
589
593
- :csharp-api:`MongoCollection.FindOne() <M_MongoDB_Driver_MongoCollection_1_FindOne_1>`
@@ -605,9 +609,6 @@ To learn how to iterate through documents in a cursor, refer to your
605
609
- id: go
606
610
content: |
607
611
608
- Additional Methods
609
- ------------------
610
-
611
612
The following methods can also read documents from a collection:
612
613
613
614
- :go-api:`Collection.FindOne <mongo#Collection.FindOne>`
0 commit comments