Skip to content

Commit

Permalink
Merge pull request #8 from ManiMozaffar/refactor-cleanup
Browse files Browse the repository at this point in the history
Refactor Aggify base code
  • Loading branch information
seyed-dev authored Oct 28, 2023
2 parents 1c0e9a7 + f4966e7 commit 8a85f5a
Show file tree
Hide file tree
Showing 15 changed files with 2,100 additions and 478 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.idea/**/dictionaries
.idea/**/shelf
.idea/*
.vscode

# AWS User-specific
.idea/**/aws.xml
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AccountDocument(Document):
disabled_at = fields.LongField()
deleted_at = fields.LongField()
banned_at = fields.LongField()

meta = {
'collection': 'account',
'ordering': ['-_id'],
Expand All @@ -65,7 +65,7 @@ class AccountDocument(Document):
'deleted_at', 'disabled_at', 'banned_at'
],
}

class PostDocument(Document):
owner = fields.ReferenceField('AccountDocument', db_field='owner_id')
caption = fields.StringField()
Expand Down Expand Up @@ -132,7 +132,7 @@ pprint(
# [{'$match': {'caption': 'hello'}}, {'$sort': {'_id': -1}}]

pprint(
query.addFields({
query.add_fields({
"new_field_1": "some_string",
"new_field_2": F("existing_field") + 10,
"new_field_3": F("field_a") * F("field_b")}
Expand All @@ -149,4 +149,3 @@ pprint(
In the sample usage above, you can see how Aggify simplifies the construction of MongoDB aggregation pipelines by allowing you to chain filters, projections, and other operations to build complex queries. The pprint(query.pipelines) line demonstrates how you can inspect the generated aggregation pipeline for debugging or analysis.

For more details and examples, please refer to the documentation and codebase.

10 changes: 9 additions & 1 deletion aggify/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
from .aggify import *
from aggify.aggify import Aggify, F, Q
from aggify.compiler import Cond

__all__ = [
"Aggify",
"Q",
"F",
"Cond",
]
Loading

0 comments on commit 8a85f5a

Please sign in to comment.