File tree Expand file tree Collapse file tree 3 files changed +50
-8
lines changed Expand file tree Collapse file tree 3 files changed +50
-8
lines changed Original file line number Diff line number Diff line change 1717# -- General configuration ---------------------------------------------------
1818# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1919
20- extensions = []
20+ # If true, the current module name will be prepended to all description
21+ # unit titles (such as .. function::).
22+ add_module_names = False
23+
24+ extensions = [
25+ "sphinx.ext.intersphinx" ,
26+ ]
2127
2228# templates_path = ["_templates"]
2329exclude_patterns = []
2430
31+ intersphinx_mapping = {
32+ "pymongo" : ("https://pymongo.readthedocs.io/en/stable/" , None ),
33+ "python" : ("https://docs.python.org/3/" , None ),
34+ "django" : (
35+ "https://docs.djangoproject.com/en/5.0/" ,
36+ "http://docs.djangoproject.com/en/5.0/_objects/" ,
37+ ),
38+ }
2539
2640# -- Options for HTML output -------------------------------------------------
2741# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
Original file line number Diff line number Diff line change 1- .. django_mongodb documentation master file, created by
2- sphinx-quickstart on Mon Apr 15 12:38:26 2024.
3- You can adapt this file completely to your liking, but it should at least
4- contain the root ``toctree`` directive.
5-
61Welcome to django_mongodb's documentation!
72==========================================
83
94.. toctree ::
10- :maxdepth: 2
5+ :maxdepth: 1
116 :caption: Contents:
127
13-
8+ querysets
149
1510Indices and tables
1611==================
Original file line number Diff line number Diff line change 1+ ``QuerySet `` API reference
2+ ==========================
3+
4+ Some MongoDB-specific ``QuerySet `` methods are available by adding a custom
5+ :class: `~django.db.models.Manager `, ``MongoManager ``, to your model::
6+
7+ from django.db import models
8+
9+ from django_mongodb.managers import MongoManager
10+
11+
12+ class MyModel(models.Model):
13+ ...
14+
15+ objects = MongoManager()
16+
17+
18+ .. currentmodule :: django_mongodb.queryset.MongoQuerySet
19+
20+ ``raw_aggregate() ``
21+ -------------------
22+
23+ .. method :: raw_aggregate(pipeline, using=None)
24+
25+ Similar to :meth: `QuerySet.raw()<django.db.models.query.QuerySet.raw> `, but
26+ instead of a raw SQL query, this method accepts a pipeline that will be passed
27+ to :meth: `pymongo.collection.Collection.aggregate `. The pipeline must return
28+ the necessary fields to construct model instances and may also return
29+ additional fields that will be added as annotations on the models.
30+
31+ For example, you could write a custom match criteria::
32+
33+ Post.objects.raw_aggregate([{"$match": {"title": "MongoDB is fun"}}])
You can’t perform that action at this time.
0 commit comments