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
@@ -302,11 +302,14 @@ These indexes use 0-based indexing.
302
302
Querying ``EmbeddedModelArrayField``
303
303
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304
304
305
-
There are a number of custom lookups and a transform for :class:`EmbeddedModelArrayField`, similar to those available for :class:`ArrayField`.
305
+
There are a number of custom lookups and a transform for
306
+
:class:`EmbeddedModelArrayField`, similar to those available
307
+
for :class:`ArrayField`.
306
308
We will use the following example model::
307
309
308
310
from django.db import models
309
-
from django_mongodb_backend.fields import EmbeddedModelArrayField, EmbeddedModelField,
311
+
from django_mongodb_backend.fields import EmbeddedModelArrayField
312
+
310
313
311
314
class Tag(EmbeddedModel):
312
315
label = models.CharField(max_length=100)
@@ -323,7 +326,8 @@ We will use the following example model::
323
326
``overlap``
324
327
^^^^^^^^^^^
325
328
326
-
Returns objects where any of the embedded documents in the field match any of the values passed. For example:
329
+
Returns objects where any of the embedded documents in the field match any of
330
+
the values passed. For example:
327
331
328
332
.. code-block:: pycon
329
333
@@ -346,7 +350,8 @@ Returns objects where any of the embedded documents in the field match any of th
346
350
``len``
347
351
^^^^^^^
348
352
349
-
Returns the length of the embedded model array. The lookups available afterward are those available for :class:`~django.db.models.IntegerField`. For example:
353
+
Returns the length of the embedded model array. The lookups available afterward
354
+
are those available for :class:`~django.db.models.IntegerField`. For example:
350
355
351
356
.. code-block:: pycon
352
357
@@ -363,7 +368,8 @@ Returns the length of the embedded model array. The lookups available afterward
363
368
``exact``
364
369
^^^^^^^^^
365
370
366
-
Returns objects where **any** embedded model in the array exactly matches the given value. This acts like an existence filter on matching embedded documents.
371
+
Returns objects where **any** embedded model in the array exactly matches the
372
+
given value. This acts like an existence filter on matching embedded documents.
367
373
368
374
.. code-block:: pycon
369
375
@@ -375,12 +381,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.
384
+
Note that this does **not** require the whole array to match, only that at
385
+
least one embedded document matches exactly.
379
386
380
387
Keytransforms
381
388
^^^^^^^^^^^^^
382
389
383
-
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:
390
+
Key transforms for :class:`EmbeddedModelArrayField` allow querying fields of
391
+
the embedded model. The transform checks if **any** element in the array has a
392
+
field matching the condition, similar to MongoDB behavior. For example:
384
393
385
394
.. code-block:: pycon
386
395
@@ -396,12 +405,11 @@ Key transforms for \:class:`EmbeddedModelArrayField` allow querying fields of th
396
405
>>> Post.objects.filter(tags__label="django")
397
406
<QuerySet [<Post: First post>, <Post: Third post>]>
0 commit comments