@@ -11,44 +11,50 @@ Query MongoDB Data
11
11
.. meta::
12
12
:keywords: app, odm, code example
13
13
14
- .. step:: Query the users collection for a specified email
14
+ .. procedure::
15
+ :style: connected
15
16
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
20
18
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
+
22
23
23
- Users.objects.filter(email="[email protected] ").first()
24
+ .. code-block:: bash
24
25
25
- This code returns the name of the matching user:
26
+ Users.objects.filter(email="[email protected] ").first()
26
27
27
- .. code-block:: bash
28
+ This code returns the name of the matching user:
28
29
29
- <QuerySet [<Users: Khal Drogo>]>
30
+ .. code-block:: bash
30
31
31
- .. step:: Query the movies collection for runtime values
32
+ <QuerySet [<Users: Khal Drogo>]>
32
33
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
36
35
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:
38
39
39
- Movies.objects.filter(runtime__lt=10)
40
+ .. code-block:: bash
40
41
41
- This code returns a truncated list of the matching movies:
42
+ Movies.objects.filter(runtime__lt=10)
42
43
43
- .. code-block:: bash
44
+ This code returns a truncated list of the matching movies:
44
45
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