Skip to content

Commit b88375c

Browse files
authored
(DOCSP-32020) Adds procedure to query documents with Atlas (#4823) (#4962)
1 parent af5014d commit b88375c

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
@@ -19,14 +19,14 @@ Query Documents
1919
:backlinks: none
2020
:depth: 1
2121

22-
----------
22+
You can query documents in MongoDB by using the following
23+
methods:
2324

24-
.. |arrow| unicode:: U+27A4
25+
.. |atlas-ref| replace:: :ref:`query-documents-atlas-ui`
2526

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
2828

29-
----------
29+
.. include:: /includes/language-selector-instructions.rst
3030

3131
.. tabs-selector:: drivers
3232

@@ -251,6 +251,40 @@ which corresponds to the following SQL statement:
251251
MongoDB supports regular expressions :query:`$regex` queries to
252252
perform string pattern matches.
253253

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+
254288
Additional Query Tutorials
255289
--------------------------
256290

@@ -381,15 +415,15 @@ To learn how to iterate through documents in a cursor, refer to your
381415
:driver:`driver's documentation </>`. If you are using ``mongosh``, see
382416
:ref:`read-operations-cursors`.
383417

418+
Additional Methods and Options
419+
------------------------------
420+
384421
.. tabs-drivers::
385422

386423
tabs:
387424
- id: shell
388425
content: |
389426

390-
Additional Methods
391-
------------------
392-
393427
The following methods can also read documents from a collection:
394428

395429
- :method:`db.collection.findOne`
@@ -407,9 +441,6 @@ To learn how to iterate through documents in a cursor, refer to your
407441
- id: compass
408442
content: |
409443

410-
Additional Options
411-
------------------
412-
413444
In addition to ``filter``, MongoDB Compass also allows the
414445
following options to be passed to the query bar:
415446

@@ -435,9 +466,6 @@ To learn how to iterate through documents in a cursor, refer to your
435466
- id: python
436467
content: |
437468

438-
Additional Methods
439-
------------------
440-
441469
The following methods can also read documents from a collection:
442470

443471
- :py:meth:`pymongo.collection.Collection.find_one`
@@ -457,9 +485,6 @@ To learn how to iterate through documents in a cursor, refer to your
457485
- id: java-sync
458486
content: |
459487

460-
Additional Methods
461-
------------------
462-
463488
The following methods can also read documents from a collection:
464489

465490
- 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
470495
- id: java-async
471496
content: |
472497

473-
Additional Methods
474-
------------------
475-
476498
The following methods can also read documents from a collection:
477499

478500
- In :doc:`aggregation pipeline </core/aggregation-pipeline>`,
@@ -484,9 +506,6 @@ To learn how to iterate through documents in a cursor, refer to your
484506
- id: nodejs
485507
content: |
486508

487-
Additional Methods
488-
------------------
489-
490509
The following methods can also read documents from a collection:
491510

492511
- :node-api:`Collection.findOne() <Collection.html#findOne>`
@@ -508,9 +527,6 @@ To learn how to iterate through documents in a cursor, refer to your
508527
- id: php
509528
content: |
510529

511-
Additional Methods
512-
------------------
513-
514530
The following methods can also read documents from a collection:
515531

516532
- :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
532548
- id: perl
533549
content: |
534550

535-
Additional Methods
536-
------------------
537-
538551
The following methods can also read documents from a collection:
539552

540553
- :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
556569
- id: ruby
557570
content: |
558571

559-
Additional Methods
560-
------------------
561-
562572
The following methods can also read documents from a collection:
563573

564574
- 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
569579
- id: scala
570580
content: |
571581

572-
Additional Methods
573-
------------------
574-
575582
The following methods can also read documents from a collection:
576583

577584
- 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
581588
- id: csharp
582589
content: |
583590

584-
Additional Methods
585-
------------------
586-
587591
The following methods can also read documents from a collection:
588592

589593
- :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
605609
- id: go
606610
content: |
607611

608-
Additional Methods
609-
------------------
610-
611612
The following methods can also read documents from a collection:
612613

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

0 commit comments

Comments
 (0)