Skip to content

Commit 0ead8c4

Browse files
authored
(DOCSP-32020) Adds procedure to query documents with Atlas (#4823)
1 parent b51b062 commit 0ead8c4

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

source/tutorial/query-documents.txt

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Query Documents
2323
:backlinks: none
2424
:depth: 1
2525

26-
----------
26+
You can query documents in MongoDB by using the following
27+
methods:
2728

28-
.. |arrow| unicode:: U+27A4
29+
.. |atlas-ref| replace:: :ref:`query-documents-atlas-ui`
2930

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
3232

33-
----------
33+
.. include:: /includes/language-selector-instructions.rst
3434

3535
.. tabs-selector:: drivers
3636

@@ -255,6 +255,40 @@ which corresponds to the following SQL statement:
255255
MongoDB supports regular expressions :query:`$regex` queries to
256256
perform string pattern matches.
257257

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+
258292
Additional Query Tutorials
259293
--------------------------
260294

@@ -385,15 +419,15 @@ To learn how to iterate through documents in a cursor, refer to your
385419
:driver:`driver's documentation </>`. If you are using ``mongosh``, see
386420
:ref:`read-operations-cursors`.
387421

422+
Additional Methods and Options
423+
------------------------------
424+
388425
.. tabs-drivers::
389426

390427
tabs:
391428
- id: shell
392429
content: |
393430

394-
Additional Methods
395-
------------------
396-
397431
The following methods can also read documents from a collection:
398432

399433
- :method:`db.collection.findOne`
@@ -411,9 +445,6 @@ To learn how to iterate through documents in a cursor, refer to your
411445
- id: compass
412446
content: |
413447

414-
Additional Options
415-
------------------
416-
417448
In addition to ``filter``, MongoDB Compass also allows the
418449
following options to be passed to the query bar:
419450

@@ -439,9 +470,6 @@ To learn how to iterate through documents in a cursor, refer to your
439470
- id: python
440471
content: |
441472

442-
Additional Methods
443-
------------------
444-
445473
The following methods can also read documents from a collection:
446474

447475
- :py:meth:`pymongo.collection.Collection.find_one`
@@ -461,9 +489,6 @@ To learn how to iterate through documents in a cursor, refer to your
461489
- id: java-sync
462490
content: |
463491

464-
Additional Methods
465-
------------------
466-
467492
The following methods can also read documents from a collection:
468493

469494
- In the :ref:`aggregation pipeline <aggregation-pipeline>`,
@@ -474,9 +499,6 @@ To learn how to iterate through documents in a cursor, refer to your
474499
- id: java-async
475500
content: |
476501

477-
Additional Methods
478-
------------------
479-
480502
The following methods can also read documents from a collection:
481503

482504
- In :ref:`aggregation pipeline <aggregation-pipeline>`,
@@ -488,9 +510,6 @@ To learn how to iterate through documents in a cursor, refer to your
488510
- id: nodejs
489511
content: |
490512

491-
Additional Methods
492-
------------------
493-
494513
The following methods can also read documents from a collection:
495514

496515
- :node-api:`Collection.findOne() <Collection.html#findOne>`
@@ -512,9 +531,6 @@ To learn how to iterate through documents in a cursor, refer to your
512531
- id: php
513532
content: |
514533

515-
Additional Methods
516-
------------------
517-
518534
The following methods can also read documents from a collection:
519535

520536
- :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
536552
- id: perl
537553
content: |
538554

539-
Additional Methods
540-
------------------
541-
542555
The following methods can also read documents from a collection:
543556

544557
- :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
560573
- id: ruby
561574
content: |
562575

563-
Additional Methods
564-
------------------
565-
566576
The following methods can also read documents from a collection:
567577

568578
- In :ref:`aggregation pipeline <aggregation-pipeline>`, the
@@ -573,9 +583,6 @@ To learn how to iterate through documents in a cursor, refer to your
573583
- id: scala
574584
content: |
575585

576-
Additional Methods
577-
------------------
578-
579586
The following methods can also read documents from a collection:
580587

581588
- In :ref:`aggregation pipeline <aggregation-pipeline>`, the
@@ -585,9 +592,6 @@ To learn how to iterate through documents in a cursor, refer to your
585592
- id: csharp
586593
content: |
587594

588-
Additional Methods
589-
------------------
590-
591595
The following methods can also read documents from a collection:
592596

593597
- :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
609613
- id: go
610614
content: |
611615

612-
Additional Methods
613-
------------------
614-
615616
The following methods can also read documents from a collection:
616617

617618
- :go-api:`Collection.FindOne <mongo#Collection.FindOne>`

0 commit comments

Comments
 (0)