diff --git a/docs/queries.md b/docs/queries.md index c46b14e..625e608 100644 --- a/docs/queries.md +++ b/docs/queries.md @@ -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 @@ -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) ``` @@ -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 @@ -1214,9 +1214,9 @@ 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** @@ -1224,8 +1224,8 @@ await User.query.create(name="Mongoz") ```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 diff --git a/docs/signals.md b/docs/signals.md index f998a1d..9260743 100644 --- a/docs/signals.md +++ b/docs/signals.md @@ -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") @@ -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") @@ -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") @@ -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") @@ -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") @@ -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")