mongodb-query-builder 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mongodb_query_builder/__init__.py +78 -0
- mongodb_query_builder/__version__.py +19 -0
- mongodb_query_builder/builders/__init__.py +18 -0
- mongodb_query_builder/builders/aggregate_builder.py +763 -0
- mongodb_query_builder/builders/atlas_search_builder.py +856 -0
- mongodb_query_builder/builders/query_filter.py +550 -0
- mongodb_query_builder/exceptions.py +51 -0
- mongodb_query_builder/operators/__init__.py +13 -0
- mongodb_query_builder/operators/operators.py +167 -0
- mongodb_query_builder/utils/__init__.py +43 -0
- mongodb_query_builder/utils/type_helpers.py +107 -0
- mongodb_query_builder/utils/validation.py +142 -0
- mongodb_query_builder-1.0.0.dist-info/METADATA +234 -0
- mongodb_query_builder-1.0.0.dist-info/RECORD +17 -0
- mongodb_query_builder-1.0.0.dist-info/WHEEL +5 -0
- mongodb_query_builder-1.0.0.dist-info/licenses/LICENSE +21 -0
- mongodb_query_builder-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MongoDB Query Builder
|
|
3
|
+
|
|
4
|
+
A fluent, type-safe query builder for MongoDB with support for complex queries,
|
|
5
|
+
aggregation pipelines, and Atlas Search.
|
|
6
|
+
|
|
7
|
+
Example Usage:
|
|
8
|
+
>>> from mongodb_query_builder import QueryFilter, AggregateBuilder
|
|
9
|
+
>>>
|
|
10
|
+
>>> # Simple query
|
|
11
|
+
>>> filter = QueryFilter()\\
|
|
12
|
+
... .field("age").greater_than(18)\\
|
|
13
|
+
... .field("status").equals("active")
|
|
14
|
+
>>>
|
|
15
|
+
>>> # Aggregation pipeline
|
|
16
|
+
>>> pipeline = AggregateBuilder()\\
|
|
17
|
+
... .match(filter)\\
|
|
18
|
+
... .group(by="$category", count={"$sum": 1})\\
|
|
19
|
+
... .sort("count", ascending=False)\\
|
|
20
|
+
... .build()
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .__version__ import (
|
|
24
|
+
__author__,
|
|
25
|
+
__description__,
|
|
26
|
+
__email__,
|
|
27
|
+
__license__,
|
|
28
|
+
__url__,
|
|
29
|
+
__version__,
|
|
30
|
+
)
|
|
31
|
+
from .builders import (
|
|
32
|
+
AggregateBuilder,
|
|
33
|
+
AtlasSearchBuilder,
|
|
34
|
+
ClauseBuilder,
|
|
35
|
+
CompoundBuilder,
|
|
36
|
+
QueryFilter,
|
|
37
|
+
)
|
|
38
|
+
from .exceptions import (
|
|
39
|
+
AggregateBuilderError,
|
|
40
|
+
AtlasSearchError,
|
|
41
|
+
MongoQueryBuilderError,
|
|
42
|
+
OperatorError,
|
|
43
|
+
QueryFilterError,
|
|
44
|
+
ValidationError,
|
|
45
|
+
)
|
|
46
|
+
from .operators import AggregateOperator, Operator, UpdateOperator
|
|
47
|
+
|
|
48
|
+
# Expose commonly used utilities
|
|
49
|
+
from .utils import ObjectId
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
# Version info
|
|
53
|
+
"__version__",
|
|
54
|
+
"__author__",
|
|
55
|
+
"__email__",
|
|
56
|
+
"__license__",
|
|
57
|
+
"__description__",
|
|
58
|
+
"__url__",
|
|
59
|
+
# Main builders
|
|
60
|
+
"QueryFilter",
|
|
61
|
+
"AggregateBuilder",
|
|
62
|
+
"AtlasSearchBuilder",
|
|
63
|
+
"CompoundBuilder",
|
|
64
|
+
"ClauseBuilder",
|
|
65
|
+
# Operators
|
|
66
|
+
"Operator",
|
|
67
|
+
"AggregateOperator",
|
|
68
|
+
"UpdateOperator",
|
|
69
|
+
# Exceptions
|
|
70
|
+
"MongoQueryBuilderError",
|
|
71
|
+
"QueryFilterError",
|
|
72
|
+
"AggregateBuilderError",
|
|
73
|
+
"AtlasSearchError",
|
|
74
|
+
"ValidationError",
|
|
75
|
+
"OperatorError",
|
|
76
|
+
# Utilities
|
|
77
|
+
"ObjectId",
|
|
78
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Version information for mongodb-query-builder."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
__author__ = "Christian De Asis"
|
|
5
|
+
__email__ = "cdeasis923@gmail.com"
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
__description__ = (
|
|
8
|
+
"A fluent, type-safe query builder for MongoDB with support for aggregations and Atlas Search"
|
|
9
|
+
)
|
|
10
|
+
__url__ = "https://github.com/ch-dev401/mongodb-query-builder"
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"__version__",
|
|
14
|
+
"__author__",
|
|
15
|
+
"__email__",
|
|
16
|
+
"__license__",
|
|
17
|
+
"__description__",
|
|
18
|
+
"__url__",
|
|
19
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Query builder classes for MongoDB.
|
|
3
|
+
|
|
4
|
+
Exports all builder classes for constructing MongoDB queries, aggregations,
|
|
5
|
+
and Atlas Search queries.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .aggregate_builder import AggregateBuilder
|
|
9
|
+
from .atlas_search_builder import AtlasSearchBuilder, ClauseBuilder, CompoundBuilder
|
|
10
|
+
from .query_filter import QueryFilter
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"QueryFilter",
|
|
14
|
+
"AggregateBuilder",
|
|
15
|
+
"AtlasSearchBuilder",
|
|
16
|
+
"CompoundBuilder",
|
|
17
|
+
"ClauseBuilder",
|
|
18
|
+
]
|