You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/ref/models/fields.rst
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -298,11 +298,14 @@ These indexes use 0-based indexing.
298
298
Querying ``EmbeddedModelArrayField``
299
299
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
300
301
-
There are a number of custom lookups and a transform for :class:`EmbeddedModelArrayField`, similar to those available for :class:`ArrayField`.
301
+
There are a number of custom lookups and a transform for
302
+
:class:`EmbeddedModelArrayField`, similar to those available
303
+
for :class:`ArrayField`.
302
304
We will use the following example model::
303
305
304
306
from django.db import models
305
-
from django_mongodb_backend.fields import EmbeddedModelArrayField, EmbeddedModelField,
307
+
from django_mongodb_backend.fields import EmbeddedModelArrayField
308
+
306
309
307
310
class Tag(EmbeddedModel):
308
311
label = models.CharField(max_length=100)
@@ -319,7 +322,8 @@ We will use the following example model::
319
322
``overlap``
320
323
^^^^^^^^^^^
321
324
322
-
Returns objects where any of the embedded documents in the field match any of the values passed. For example:
325
+
Returns objects where any of the embedded documents in the field match any of
326
+
the values passed. For example:
323
327
324
328
.. code-block:: pycon
325
329
@@ -342,7 +346,8 @@ Returns objects where any of the embedded documents in the field match any of th
342
346
``len``
343
347
^^^^^^^
344
348
345
-
Returns the length of the embedded model array. The lookups available afterward are those available for :class:`~django.db.models.IntegerField`. For example:
349
+
Returns the length of the embedded model array. The lookups available afterward
350
+
are those available for :class:`~django.db.models.IntegerField`. For example:
346
351
347
352
.. code-block:: pycon
348
353
@@ -359,7 +364,8 @@ Returns the length of the embedded model array. The lookups available afterward
359
364
``exact``
360
365
^^^^^^^^^
361
366
362
-
Returns objects where **any** embedded model in the array exactly matches the given value. This acts like an existence filter on matching embedded documents.
367
+
Returns objects where **any** embedded model in the array exactly matches the
368
+
given value. This acts like an existence filter on matching embedded documents.
363
369
364
370
.. code-block:: pycon
365
371
@@ -371,12 +377,15 @@ Returns objects where **any** embedded model in the array exactly matches the gi
Note that this does **not** require the whole array to match, only that at least one embedded document matches exactly.
380
+
Note that this does **not** require the whole array to match, only that at
381
+
least one embedded document matches exactly.
375
382
376
383
Keytransforms
377
384
^^^^^^^^^^^^^
378
385
379
-
Key transforms for \:class:`EmbeddedModelArrayField` allow querying fields of the embedded model. The transform checks if **any** element in the array has a field matching the condition, similar to MongoDB behavior. For example:
386
+
Key transforms for :class:`EmbeddedModelArrayField` allow querying fields of
387
+
the embedded model. The transform checks if **any** element in the array has a
388
+
field matching the condition, similar to MongoDB behavior. For example:
380
389
381
390
.. code-block:: pycon
382
391
@@ -392,12 +401,11 @@ Key transforms for \:class:`EmbeddedModelArrayField` allow querying fields of th
392
401
>>> Post.objects.filter(tags__label="django")
393
402
<QuerySet [<Post: First post>, <Post: Third post>]>
0 commit comments