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 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
+ ]