Skip to content

Commit 6f2c49b

Browse files
committed
Minor README tweaks
1 parent 5974fe0 commit 6f2c49b

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Simple JSON document storage on disk.
44

55
- 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.
99

1010
## Installation
1111

@@ -35,7 +35,7 @@ Commands:
3535
- `queryby FIELD VALUE`
3636
- `createindex FIELD`
3737
- `deleteindex FIELD`
38-
- `insert KEY JSON_DOCUMENT`
38+
- `insert KEY JSON_DOCUMENT` valid keys may contain letters, digits, `.`, `_`, and `-`. No whitespace.
3939
- `update KEY JSON_DOCUMENT`
4040
- `delete KEY`
4141
- `exit`
@@ -73,6 +73,10 @@ jsondocstore> queryby role user
7373

7474
## Using from your Python application
7575

76+
Learn the API by reading the [API reference](https://mortensi.github.io/jsondocstore/api/jsondocstore.html).
77+
78+
Example:
79+
7680
```python
7781
from jsondocstore import JsonDocStore
7882

@@ -87,17 +91,10 @@ admins = store.query_by("role", "admin")
8791
doc = store.get("user-1")
8892
```
8993

90-
## Data Model
91-
92-
- `get(key)` reads `<key>.json`.
93-
- `insert(key, doc)` writes `<key>.json`.
94-
- Valid keys may contain letters, digits, `.`, `_`, and `-`. No whitespace.
95-
9694
## Schema
9795

98-
`index.json` is optional.
96+
The schema file `index.json` is optional and required only if you want to use indexes.
9997

100-
- `create=True` creates the directory if needed. It does not create `index.json`.
10198
- `index_fields` defines which fields are indexed in memory.
10299
- `get()`, `insert()`, `delete()`, and `list_all()` work without `index.json`.
103100
- `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

Comments
 (0)