fix: correct wrong success predicates in upsert_document_field and create_documents
upsert_document_field returned False for an idempotent no-op upsert on an existing document (modified_count=0, upserted_id=None) even though the doc matched the requested state; switch to matched_count like its update_document_field and update_document_operator siblings. create_documents returned 0 on a partial insert_many failure, discarding the BulkWriteError's nInserted count and inviting callers to retry the whole batch on a wrongly-reported failure, duplicating documents that had already landed. Catch BulkWriteError specifically and return e.details['nInserted']. Bump to v0.1.7. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "mongo"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
description = "async mongodb wrapper over motor with a raw escape hatch"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
Reference in New Issue
Block a user