@@ -11,44 +11,50 @@ Query MongoDB Data
1111.. meta::
1212 :keywords: app, odm, code example
1313
14- .. step:: Query the users collection for a specified email
14+ .. procedure::
15+ :style: connected
1516
16- From the same Python shell as the :ref:`django-get-started-create-app`
17- step of this tutorial, run the following code to query the
18- ``sample_mflix.users`` collection for a user whose email is
19- 17+ .. step:: Query the users collection for a specified email
2018
21- .. code-block:: bash
19+ From the same Python shell as the :ref:`django-get-started-create-app`
20+ step of this tutorial, run the following code to query the
21+ ``sample_mflix.users`` collection for a user whose email is
22+ 2223
23- Users.objects.filter(email="[email protected] ").first() 24+ .. code-block:: bash
2425
25- This code returns the name of the matching user:
26+ Users.objects.filter(email="[email protected] ").first() 2627
27- .. code-block:: bash
28+ This code returns the name of the matching user:
2829
29- <QuerySet [<Users: Khal Drogo>]>
30+ .. code-block:: bash
3031
31- .. step:: Query the movies collection for runtime values
32+ <QuerySet [<Users: Khal Drogo>]>
3233
33- Run the following code to query the ``sample_mflix.movies``
34- collection for movies that have a runtime value less than
35- 10:
34+ .. step:: Query the movies collection for runtime values
3635
37- .. code-block:: bash
36+ Run the following code to query the ``sample_mflix.movies``
37+ collection for movies that have a runtime value less than
38+ 10:
3839
39- Movies.objects.filter(runtime__lt=10)
40+ .. code-block:: bash
4041
41- This code returns a truncated list of the matching movies:
42+ Movies.objects.filter(runtime__lt=10)
4243
43- .. code-block:: bash
44+ This code returns a truncated list of the matching movies:
4445
45- <QuerySet [<Movies: Winsor McCay, the Famous Cartoonist of the N.Y.
46- Herald and His Moving Comics>, <Movies: Steamboat Willie>, <Movies:
47- Three Little Pigs>, <Movies: The Band Concert>, <Movies: Who Killed Cock Robin?>,
48- <Movies: Dots>, <Movies: The Cat Concerto>, <Movies: Begone Dull Care>,
49- <Movies: Mi adorado Juan>, <Movies: Neighbours>, <Movies: A Phantasy>,
50- <Movies: Duck Amuck>, <Movies: Duck Dodgers in the 24èth Century>,
51- <Movies: Blinkity Blank>, <Movies: One Froggy Evening>,
52- <Movies: What's Opera, Doc?>, <Movies: Lines: Horizontal>,
53- <Movies: Il fornaretto di Venezia>, <Movies: Dog Star Man: Part IV>,
54- <Movies: Now>, '...(remaining elements truncated)...']>
46+ .. code-block:: bash
47+
48+ <QuerySet [<Movies: Winsor McCay, the Famous Cartoonist of the N.Y.
49+ Herald and His Moving Comics>, <Movies: Steamboat Willie>, <Movies:
50+ Three Little Pigs>, <Movies: The Band Concert>, <Movies: Who Killed Cock Robin?>,
51+ <Movies: Dots>, <Movies: The Cat Concerto>, <Movies: Begone Dull Care>,
52+ <Movies: Mi adorado Juan>, <Movies: Neighbours>, <Movies: A Phantasy>,
53+ <Movies: Duck Amuck>, <Movies: Duck Dodgers in the 24èth Century>,
54+ <Movies: Blinkity Blank>, <Movies: One Froggy Evening>,
55+ <Movies: What's Opera, Doc?>, <Movies: Lines: Horizontal>,
56+ <Movies: Il fornaretto di Venezia>, <Movies: Dog Star Man: Part IV>,
57+ <Movies: Now>, '...(remaining elements truncated)...']>
58+
59+ After completing this step, you can run queries on data stored in
60+ your MongoDB deployment.
0 commit comments