Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdfd441641 | ||
|
|
4c7d5ff46d |
No files matched your search
@@ -8,18 +8,18 @@ helpers for the common paths, with a raw escape hatch for everything else.
|
|||||||
`requirements.txt`:
|
`requirements.txt`:
|
||||||
|
|
||||||
```
|
```
|
||||||
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v1.0.0
|
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v1.2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Direct:
|
Direct:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v1.0.0"
|
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v1.2.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
Requires `motor` and `pymongo` (pulled transitively).
|
Requires `motor` and `pymongo` (pulled transitively).
|
||||||
|
|
||||||
Drop the `@v1.0.0` suffix from the line above to install the latest unpinned.
|
Drop the `@v1.2.0` suffix from the line above to install the latest unpinned.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "mongo"
|
name = "mongo"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
description = "async mongodb wrapper over motor with a raw escape hatch"
|
description = "async mongodb wrapper over motor with a raw escape hatch"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
+2
-2
@@ -328,7 +328,7 @@ class MongoDB:
|
|||||||
"""replace a whole document, optionally upserting"""
|
"""replace a whole document, optionally upserting"""
|
||||||
try:
|
try:
|
||||||
response = await self._db[collection].replace_one(target, document, upsert=upsert)
|
response = await self._db[collection].replace_one(target, document, upsert=upsert)
|
||||||
return bool(response.matched_count or response.upserted_id)
|
return response.matched_count > 0 or response.upserted_id is not None
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("db.update_document() on %s", collection)
|
log.exception("db.update_document() on %s", collection)
|
||||||
return False
|
return False
|
||||||
@@ -382,7 +382,7 @@ class MongoDB:
|
|||||||
response = await self._db[collection].update_one(
|
response = await self._db[collection].update_one(
|
||||||
target, {"$set": updates}, upsert=True
|
target, {"$set": updates}, upsert=True
|
||||||
)
|
)
|
||||||
return bool(response.matched_count or response.upserted_id)
|
return response.matched_count > 0 or response.upserted_id is not None
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("db.upsert_document_field() on %s", collection)
|
log.exception("db.upsert_document_field() on %s", collection)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in new issue
Block a user