Skip to content

Commit 17b5505

Browse files
committed
edits
1 parent 53bbe4c commit 17b5505

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

source/interact-data/specify-a-query.txt

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ Retrieve All Documents
101101
~~~~~~~~~~~~~~~~~~~~~~
102102

103103
To retrieve all documents from a collection, call the ``all()``
104-
method on the collection's corresponding Django model.
104+
function on the collection's corresponding Django model.
105105

106-
The following example calls the ``all()`` method on the
106+
The following example calls the ``all()`` function on the
107107
``Movie`` model to retrieve all documents in the ``sample_mflix.movies``
108108
collection:
109109

@@ -135,11 +135,11 @@ Retrieve Matching Documents
135135
~~~~~~~~~~~~~~~~~~~~~~~~~~~
136136

137137
To query a collection for documents that match a set of criteria,
138-
call the ``filter()`` method on the collection's corresponding Django
139-
model. Pass a query filter to the ``filter()`` method that specifies your
138+
call the ``filter()`` function on the collection's corresponding Django
139+
model. Pass a query filter to the ``filter()`` function that specifies your
140140
query criteria.
141141

142-
The following example calls the ``filter()`` method on the
142+
The following example calls the ``filter()`` function on the
143143
``Movie`` model to query the ``sample_mflix.movies`` collection
144144
for documents that have a ``runtime`` value of ``300``:
145145

@@ -163,19 +163,19 @@ Retrieve One Document
163163
~~~~~~~~~~~~~~~~~~~~~
164164

165165
To retrieve one document from a collection, call the ``get()``
166-
method on the collection's corresponding Django model. Pass
167-
a query filter to the ``get()`` method that specifies your
166+
function on the collection's corresponding Django model. Pass
167+
a query filter to the ``get()`` function that specifies your
168168
query criteria.
169169

170170
.. important::
171171

172172
If your query matches no documents or multiple documents, the ``get()``
173-
method generates an error. To retrieve one document from a query
173+
function generates an error. To retrieve one document from a query
174174
that might match multiple, use the :ref:`first() <django-query-first>`
175-
method.
175+
function.
176176

177177

178-
The following example calls the ``get()`` method on the
178+
The following example calls the ``get()`` function on the
179179
``Movie`` model to retrieve one document that has a ``title``
180180
value of ``"Finding Nemo"``:
181181

@@ -198,11 +198,11 @@ Exclude Matching Documents
198198
~~~~~~~~~~~~~~~~~~~~~~~~~~
199199

200200
To query a collection for documents that do not meet your
201-
search criteria, call the ``exclude()`` method on the collection's
201+
search criteria, call the ``exclude()`` function on the collection's
202202
corresponding Django model. Pass the exclusion criteria as an
203-
argument to the ``exclude()`` method.
203+
argument to the ``exclude()`` function.
204204

205-
The following example calls the ``exclude()`` method on the
205+
The following example calls the ``exclude()`` function on the
206206
``Movie`` model to exclude documents released before January 1,
207207
1980 from the results:
208208

@@ -489,7 +489,7 @@ Sort Results
489489
~~~~~~~~~~~~
490490

491491
You can provide a sort order for your query results by using the
492-
``order_by()`` method. To specify an ascending sort based on values
492+
``order_by()`` function. To specify an ascending sort based on values
493493
of a given field, pass the field name as an argument. To specify a descending
494494
sort, pass the field name prefixed with a minus symbol (``-``) as an argument.
495495

@@ -498,7 +498,7 @@ Example
498498

499499
This example performs the following actions:
500500

501-
- Calls the ``filter()`` method on the ``Movie`` model to query
501+
- Calls the ``filter()`` function on the ``Movie`` model to query
502502
the ``sample_mflix.movies`` collection
503503
- Queries documents that have a ``title`` value starting
504504
with the text ``"Rocky"``
@@ -542,12 +542,15 @@ If you omit the ``<start>`` value, the query returns each result,
542542
beginning with the first match, until it returns the number specified
543543
by the ``<end>`` value.
544544

545+
If you omit the ``<end>`` value, the query returns each result
546+
but skips the number of initial results specified by ``<start>``.
547+
545548
Example
546549
```````
547550

548551
This example performs the following actions:
549552

550-
- Calls the ``filter()`` method on the ``Movie`` model to query
553+
- Calls the ``filter()`` function on the ``Movie`` model to query
551554
the ``sample_mflix.movies`` collection
552555
- Queries documents that have a ``released`` value of
553556
``datetime(2010, 7, 16)`` (July 16, 2010)
@@ -572,11 +575,11 @@ Retrieve the First Result
572575
~~~~~~~~~~~~~~~~~~~~~~~~~
573576

574577
To retrieve the first result from a query that might match
575-
multiple results, chain the ``first()`` method to the ``filter()``
576-
method. Pass a query filter to the ``filter()`` method that specifies your
578+
multiple results, chain the ``first()`` function to the ``filter()``
579+
function. Pass a query filter to the ``filter()`` function that specifies your
577580
query criteria.
578581

579-
The following example calls the ``filter()`` and ``first()`` methods on the
582+
The following example calls the ``filter()`` and ``first()`` functions on the
580583
``Movie`` model to query the ``sample_mflix.movies`` collection
581584
for the first document in which the ``genres`` value is
582585
``["Crime", "Comedy"]``:
@@ -644,9 +647,9 @@ for values of its nested ``votes`` field that exceed ``900000``:
644647
JSONField Transforms
645648
````````````````````
646649

647-
You can use the ``KT()`` method to specify a key, index, or path
650+
You can use the ``KT()`` function to specify a key, index, or path
648651
transform of a ``JSONField``. For example, the following code uses
649-
the ``annotate()`` and ``KT()`` methods to create a new ``score`` key, which
652+
the ``annotate()`` and ``KT()`` functions to create a new ``score`` key, which
650653
stores ``imdb.rating`` nested field values. Then, the code sorts
651654
each document in the ``sample_mflix.movies`` collection by
652655
their descending ``score`` values:
@@ -688,7 +691,7 @@ for a document whose primary key is ``ObjectId("573a1394f29313caabce0d37")``:
688691

689692
.. input:: /includes/interact-data/specify-a-query.py
690693
:start-after: start-primary-key-pk
691-
:end-before: end-primary-keypk
694+
:end-before: end-primary-key-pk
692695
:language: python
693696

694697
.. output::

0 commit comments

Comments
 (0)