Skip to content

Commit 42d9062

Browse files
committed
Add docs.
1 parent 2558faf commit 42d9062

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

docs/releases/5.2.x.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ Django MongoDB Backend 5.2.x
1010
New features
1111
------------
1212

13-
- ...
13+
- Added support for creating indexes from expressions.
14+
Currently, only ``F()`` expressions are supported to reference top-level
15+
model fields inside embedded models.
16+
17+
1418

1519
Bug fixes
1620
---------

docs/topics/indexes.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Indexes from Expressions
2+
3+
Django MongoDB Backend now supports creating indexes from expressions.
4+
Currently, only `F()` expressions are supported, which allows referencing
5+
fields from the top-level model inside embedded fields.
6+
7+
Example:
8+
```python
9+
class Author(models.EmbeddedModel):
10+
name = models.CharField()
11+
12+
class Book(models.Model):
13+
author = models.EmbeddedField(Author)
14+
15+
class Meta:
16+
indexes = [
17+
models.Index(F("author__name")),
18+
]

0 commit comments

Comments
 (0)