You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
Simple JSON document storage on disk.
4
4
5
5
- A Python library to organize and query JSON documents on disk, basically, with no running process.
6
-
-Each document is stored as one file named `<key>.json`. The document key is the filename stem.
7
-
-If you want to organize documents into different folders, use one `JsonDocStore` instance per folder. Each instance manages only the JSON files in its own directory.
8
-
- If you want to query by a field, create an index on it. This will create an `index.json` file in the store directory. It is not required for basic operations like `insert`, `update`, `delete`, and `get`.
6
+
-You instantiate a `JsonDocStore` object with a root directory where your JSON documents will be stored. If you want to organize documents into different folders, use one `JsonDocStore` instance per folder. Each instance manages only the JSON files in its own directory. E.g. `JsonDocStore("./data/users")` and `JsonDocStore("./data/products")`.
7
+
-Each document is stored as a file named `<key>.json`. The document key is the filename stem.
8
+
- If you want to query by a field, create an index on it. This will create an `index.json` file in the store directory. Currently, only exact match is supported. It is not required for basic operations like `insert`, `update`, `delete`, and `get`. The index is in-memory, not persisted to disk and is rebuilt when the store is opened.
9
9
10
10
## Installation
11
11
@@ -35,7 +35,7 @@ Commands:
35
35
-`queryby FIELD VALUE`
36
36
-`createindex FIELD`
37
37
-`deleteindex FIELD`
38
-
-`insert KEY JSON_DOCUMENT`
38
+
-`insert KEY JSON_DOCUMENT` valid keys may contain letters, digits, `.`, `_`, and `-`. No whitespace.
39
39
-`update KEY JSON_DOCUMENT`
40
40
-`delete KEY`
41
41
-`exit`
@@ -73,6 +73,10 @@ jsondocstore> queryby role user
73
73
74
74
## Using from your Python application
75
75
76
+
Learn the API by reading the [API reference](https://mortensi.github.io/jsondocstore/api/jsondocstore.html).
- Valid keys may contain letters, digits, `.`, `_`, and `-`. No whitespace.
95
-
96
94
## Schema
97
95
98
-
`index.json` is optional.
96
+
The schema file `index.json` is optional and required only if you want to use indexes.
99
97
100
-
-`create=True` creates the directory if needed. It does not create `index.json`.
101
98
-`index_fields` defines which fields are indexed in memory.
102
99
-`get()`, `insert()`, `delete()`, and `list_all()` work without `index.json`.
103
100
-`query_by()` only works when an index exists. It returns a mapping of `key -> document`. Querying without an index, or on a non-indexed field, raises an error.
0 commit comments