Skip to content

Commit

Permalink
Fix document references
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Jan 19, 2024
1 parent 91b8aed commit 6277d2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
38 changes: 19 additions & 19 deletions docs/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ The same special operators are also automatically added on every column.
##### Example

```python
users = await User.query.filter(email__icontains="foo")
users = await User.query.filter(id__in=[1, 2, 3])
users = await User.query.filter(id__not_in=[1, 2, 3])
users = await User.query.filter(id__gt=1)
users = await User.query.filter(id__lte=3)
users = await User.query.filter(id__lt=2)
users = await User.query.filter(id__gte=4)
users = await User.query.filter(id__asc=True)
users = await User.query.filter(id__asc=False) # same as desc True
users = await User.query.filter(id__desc=True)
users = await User.query.filter(id__desc=False) # same as asc True
users = await User.query.filter(id__neq=1) # same as asc True
users = await User.objects.filter(email__icontains="foo")
users = await User.objects.filter(id__in=[1, 2, 3])
users = await User.objects.filter(id__not_in=[1, 2, 3])
users = await User.objects.filter(id__gt=1)
users = await User.objects.filter(id__lte=3)
users = await User.objects.filter(id__lt=2)
users = await User.objects.filter(id__gte=4)
users = await User.objects.filter(id__asc=True)
users = await User.objects.filter(id__asc=False) # same as desc True
users = await User.objects.filter(id__desc=True)
users = await User.objects.filter(id__desc=False) # same as asc True
users = await User.objects.filter(id__neq=1) # same as asc True
```

### Query
Expand Down Expand Up @@ -177,7 +177,7 @@ Limiting the number of results.
=== "Manager"

```python
users = await User.obje ts.limit(1)
users = await User.objects.limit(1)

users = await User.objects.filter(email__icontains="mongo").limit(2)
```
Expand All @@ -187,7 +187,7 @@ Limiting the number of results.
```python
users = await User.query().limit(1)

users = await User.query.sort(User.email, Order.ASCENDING).limit(2)
users = await User.query().sort(User.email, Order.ASCENDING).limit(2)
```

### Skip
Expand Down Expand Up @@ -1214,18 +1214,18 @@ Let us see some examples.
**Async mode**

```python
await User.query.all()
await User.query.filter(name__icontains="example")
await User.query.create(name="Mongoz")
await User.objects.all()
await User.objects.filter(name__icontains="example")
await User.objects.create(name="Mongoz")
```

**With run_sync**

```python
from mongoz import run_sync

run_sync(User.query.filter(name__icontains="example"))
run_sync(User.query.create(name="Mongoz"))
run_sync(User.objects.filter(name__icontains="example"))
run_sync(User.objects.create(name="Mongoz"))
```

[document]: ./documents.md
12 changes: 6 additions & 6 deletions docs/signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ from mongoz.core.signals import (
#### pre_save

The `pre_save` is used when a document is about to be saved and triggered on `Document.save()` and
`Document.query.create` functions.
`Document.objects.create` functions.

```python
pre_save(send: Type["Document"], instance: "Document")
Expand All @@ -55,7 +55,7 @@ pre_save(send: Type["Document"], instance: "Document")

The `post_save` is used after the document is already created and stored in the database, meaning,
when an instance already exists after `save`. This signal is triggered on `Document.save()` and
`Document.query.create` functions.
`Document.objects.create` functions.

```python
post_save(send: Type["Document"], instance: "Document")
Expand All @@ -64,7 +64,7 @@ post_save(send: Type["Document"], instance: "Document")
#### pre_update

The `pre_update` is used when a document is about to receive the updates and triggered on `Document.update()`
and `Document.query.update` functions.
and `Document.objects.update` functions.

```python
pre_update(send: Type["Document"], instance: "Document")
Expand All @@ -73,7 +73,7 @@ pre_update(send: Type["Document"], instance: "Document")
#### post_update

The `post_update` is used when a document **already performed the updates** and triggered on `Document.update()`
and `Document.query.update` functions.
and `Document.objects.update` functions.

```python
post_update(send: Type["Document"], instance: "Document")
Expand All @@ -82,7 +82,7 @@ post_update(send: Type["Document"], instance: "Document")
#### pre_delete

The `pre_delete` is used when a document is about to be deleted and triggered on `Document.delete()`
and `Document.query.delete` functions.
and `Document.objects.delete` functions.

```python
pre_delete(send: Type["Document"], instance: "Document")
Expand All @@ -91,7 +91,7 @@ pre_delete(send: Type["Document"], instance: "Document")
#### post_delete

The `post_update` is used when a document **is already deleted** and triggered on `Document.delete()`
and `Document.query.delete` functions.
and `Document.objects.delete` functions.

```python
post_update(send: Type["Document"], instance: "Document")
Expand Down

0 comments on commit 6277d2c

Please sign in to comment.