(self)
| 365 | self.assertEqual(1, self.coll.count_documents({"x": 1})) |
| 366 | |
| 367 | def test_client_generated_upsert_id(self): |
| 368 | result = self.coll.bulk_write( |
| 369 | [ |
| 370 | UpdateOne({"_id": 0}, {"$set": {"a": 0}}, upsert=True), |
| 371 | ReplaceOne({"a": 1}, {"_id": 1}, upsert=True), |
| 372 | # This is just here to make the counts right in all cases. |
| 373 | ReplaceOne({"_id": 2}, {"_id": 2}, upsert=True), |
| 374 | ] |
| 375 | ) |
| 376 | self.assertEqualResponse( |
| 377 | { |
| 378 | "nMatched": 0, |
| 379 | "nModified": 0, |
| 380 | "nUpserted": 3, |
| 381 | "nInserted": 0, |
| 382 | "nRemoved": 0, |
| 383 | "upserted": [ |
| 384 | {"index": 0, "_id": 0}, |
| 385 | {"index": 1, "_id": 1}, |
| 386 | {"index": 2, "_id": 2}, |
| 387 | ], |
| 388 | }, |
| 389 | result.bulk_api_result, |
| 390 | ) |
| 391 | |
| 392 | def test_upsert_uuid_standard(self): |
| 393 | options = CodecOptions(uuid_representation=UuidRepresentation.STANDARD) |
nothing calls this directly
no test coverage detected