Skip to content

Commit d708364

Browse files
committed
Add admonition about range queries vs. lookups
1 parent 923354a commit d708364

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/topics/queryable-encryption.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ For example, to find a patient by their SSN, you can do the following::
123123

124124
>>> patient = Patient.objects.get(patient_record__ssn="123-45-6789")
125125
>>> patient.name
126-
'Bob'
126+
'John Doe'
127+
128+
.. admonition:: Range queries vs. lookups
129+
130+
Range queries in Queryable Encryption are different from Django's
131+
:ref:`range lookups <django:field-lookups>`
132+
Range queries allow you to perform comparisons on encrypted fields,
133+
while Django's range lookups are used for filtering based on a range of
134+
values.
135+
136+
For example, if you have an encrypted field that supports range queries, you
137+
can perform a query like this::
138+
139+
from myapp.models import Patient
140+
141+
>>> patients = Patient.objects.filter(patient_record__ssn__gte="123-45-0000",
142+
... patient_record__ssn__lte="123-45-9999")
143+
144+
This will return all patients whose SSN falls within the specified range.
127145

128146
.. _Python Queryable Encryption Tutorial: https://github.com/mongodb/docs/tree/main/content/manual/manual/source/includes/qe-tutorials/python

0 commit comments

Comments
 (0)