Skip to content

DOCSP-46425: Specify a Query #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion source/includes/interact-data/specify-a-query.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def __str__(self):
# end-filter-relationships

# start-filter-combine
Movie.objects.filter(awards__text__istartswith="nominated")
Movie.objects.filter(
(Q(title__startswith="Funny") | Q(title__startswith="Laugh"))
& ~Q(genres__contains=["Comedy"]))
# end-filter-combine

# start-sort
Expand All @@ -71,6 +73,10 @@ def __str__(self):
Movie.objects.filter(genres=["Crime", "Comedy"]).first()
# end-first

# start-array
Movie.objects.filter(genres__overlap=["Adventure", "Family"])
# end-array

# start-json
Movie.objects.filter(imdb__votes__gt=900000)
# end-json
Expand Down
11 changes: 5 additions & 6 deletions source/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ Django MongoDB Backend

.. toctree::

Interact with Data </interact-data>
Issues & Help </issues-and-help>
Compatibility </compatibility>


.. TODO:
Get Started </get-started>
Connection Configuration </connect>
Interact with Data </interact-data>
Model Your Data </model-data>
Django Feature Limitations </feature-limitations>
API Documentation <{+api+}>
Expand All @@ -43,11 +42,11 @@ a Django database backend that uses PyMongo to connect to MongoDB.
.. Learn how to configure a connection to a MongoDB deployment
in the :ref:`django-connection-configuration` section.

.. Interact with Data
.. ------------------
Interact with Data
------------------

.. Learn how to use {+django-odm+} to perform operations on MongoDB data
in the :ref:`django-interact-data` section.
Learn how to use {+django-odm+} to perform operations on MongoDB data
in the :ref:`django-interact-data` section.

.. Model Your Data
.. ---------------
Expand Down
17 changes: 17 additions & 0 deletions source/interact-data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _django-interact-data:

==================
Interact with Data
==================

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: odm, crud, query

.. toctree::
:caption: Interact with Data

Specify a Query </interact-data/specify-a-query>
Loading
Loading