minidb-db 0.1.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.
- minidb/__init__.py +79 -0
- minidb/aggregation.py +738 -0
- minidb/bson.py +151 -0
- minidb/collection.py +696 -0
- minidb/comparison.py +322 -0
- minidb/database.py +136 -0
- minidb/demo.py +212 -0
- minidb/engine.py +644 -0
- minidb/errors.py +68 -0
- minidb/index.py +389 -0
- minidb/objectid.py +105 -0
- minidb/paths.py +92 -0
- minidb/query.py +442 -0
- minidb/update.py +509 -0
- minidb/validation.py +246 -0
- minidb/webui/__init__.py +7 -0
- minidb/webui/__main__.py +46 -0
- minidb/webui/server.py +403 -0
- minidb/webui/static/app.css +255 -0
- minidb/webui/static/app.js +449 -0
- minidb/webui/static/index.html +145 -0
- minidb_db-0.1.0.dist-info/METADATA +407 -0
- minidb_db-0.1.0.dist-info/RECORD +27 -0
- minidb_db-0.1.0.dist-info/WHEEL +5 -0
- minidb_db-0.1.0.dist-info/entry_points.txt +2 -0
- minidb_db-0.1.0.dist-info/licenses/LICENSE +21 -0
- minidb_db-0.1.0.dist-info/top_level.txt +1 -0
minidb/__init__.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""minidb -- a MongoDB-style document database written from scratch.
|
|
2
|
+
|
|
3
|
+
from minidb import Database
|
|
4
|
+
|
|
5
|
+
db = Database("app.db")
|
|
6
|
+
db.create_collection("users")
|
|
7
|
+
db.users.insert_one({"name": "Ada", "role": "engineer"})
|
|
8
|
+
db.users.find_one({"role": "engineer"})
|
|
9
|
+
|
|
10
|
+
The API deliberately mirrors PyMongo's, so application code can move between
|
|
11
|
+
this database and a real MongoDB server with few changes.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from .aggregation import evaluate_expression, run_pipeline
|
|
17
|
+
from .bson import Document
|
|
18
|
+
from .collection import (
|
|
19
|
+
Collection,
|
|
20
|
+
Cursor,
|
|
21
|
+
DeleteResult,
|
|
22
|
+
InsertManyResult,
|
|
23
|
+
InsertOneResult,
|
|
24
|
+
ReturnDocument,
|
|
25
|
+
UpdateResult,
|
|
26
|
+
)
|
|
27
|
+
from .comparison import compare, values_equal
|
|
28
|
+
from .database import Database
|
|
29
|
+
from .errors import (
|
|
30
|
+
CollectionAlreadyExists,
|
|
31
|
+
CollectionNotFound,
|
|
32
|
+
ConfigurationError,
|
|
33
|
+
DocumentNotFound,
|
|
34
|
+
DuplicateKeyError,
|
|
35
|
+
InvalidDocument,
|
|
36
|
+
InvalidOperation,
|
|
37
|
+
MiniDBError,
|
|
38
|
+
OperationFailure,
|
|
39
|
+
ValidationError,
|
|
40
|
+
WriteError,
|
|
41
|
+
)
|
|
42
|
+
from .objectid import ObjectId
|
|
43
|
+
from .query import match_document
|
|
44
|
+
from .update import apply_update
|
|
45
|
+
from .validation import Validator
|
|
46
|
+
|
|
47
|
+
__version__ = "0.1.0"
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"Database",
|
|
51
|
+
"Collection",
|
|
52
|
+
"Cursor",
|
|
53
|
+
"ObjectId",
|
|
54
|
+
"Document",
|
|
55
|
+
"Validator",
|
|
56
|
+
"ReturnDocument",
|
|
57
|
+
"InsertOneResult",
|
|
58
|
+
"InsertManyResult",
|
|
59
|
+
"UpdateResult",
|
|
60
|
+
"DeleteResult",
|
|
61
|
+
"MiniDBError",
|
|
62
|
+
"ConfigurationError",
|
|
63
|
+
"CollectionNotFound",
|
|
64
|
+
"CollectionAlreadyExists",
|
|
65
|
+
"DocumentNotFound",
|
|
66
|
+
"DuplicateKeyError",
|
|
67
|
+
"WriteError",
|
|
68
|
+
"ValidationError",
|
|
69
|
+
"InvalidOperation",
|
|
70
|
+
"InvalidDocument",
|
|
71
|
+
"OperationFailure",
|
|
72
|
+
"match_document",
|
|
73
|
+
"apply_update",
|
|
74
|
+
"compare",
|
|
75
|
+
"values_equal",
|
|
76
|
+
"evaluate_expression",
|
|
77
|
+
"run_pipeline",
|
|
78
|
+
"__version__",
|
|
79
|
+
]
|