fix: rename create_collection indexes->index + doc notes (mongo-3/4/5)

- mongo-3: create_collection param renamed indexes -> index (it seeds ONE index; a key-spec
  builds one compound index, not two). update keyword call sites indexes= -> index=.
- mongo-4: docstring notes an instance is single-use after close() (pymongo 4.x close is
  irreversible; connect() only pings).
- mongo-5: docstring notes construction may raise InvalidURI for a malformed URI.
- README: create_collection index note. bump v0.1.5 -> v0.1.6

Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
2026-07-01 00:28:36 -04:00
parent ebd808f326
commit 9da851629d
3 changed files with 26 additions and 9 deletions
+6 -3
View File
@@ -8,18 +8,18 @@ helpers for the common paths, with a raw escape hatch for everything else.
`requirements.txt`:
```
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.5
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.6
```
Direct:
```bash
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.5"
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.6"
```
Requires `motor` and `pymongo` (pulled transitively).
Drop the `@v0.1.5` suffix from the line above to install the latest unpinned.
Drop the `@v0.1.6` suffix from the line above to install the latest unpinned.
## Usage
@@ -87,6 +87,9 @@ are included.
- `from mongo import func` won't see the proxy (resolved at import, before `init`).
Use `import mongo` then `mongo.func(...)`.
- `create_collection(collection, index=...)` seeds **one** index (the param is `index`,
renamed from `indexes` in v0.1.6). A key-spec like `[("a",1),("b",1)]` builds one
compound index, not two — call `create_index` per index for multiples.
- `find_one_and_update` returns the **after** image by default (`return_after=True`).
- `bulk_write` takes pymongo ops the caller builds:
```python