MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_upsert_large

Method test_upsert_large

test/test_bulk.py:350–365  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

348 self.coll.bulk_write([{}]) # type: ignore[list-item]
349
350 def test_upsert_large(self):
351 big = "a" * (client_context.max_bson_size - 37)
352 result = self.coll.bulk_write([UpdateOne({"x": 1}, {"$set": {"s": big}}, upsert=True)])
353 self.assertEqualResponse(
354 {
355 "nMatched": 0,
356 "nModified": 0,
357 "nUpserted": 1,
358 "nInserted": 0,
359 "nRemoved": 0,
360 "upserted": [{"index": 0, "_id": "..."}],
361 },
362 result.bulk_api_result,
363 )
364
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(

Callers

nothing calls this directly

Calls 4

UpdateOneClass · 0.85
bulk_writeMethod · 0.45
assertEqualResponseMethod · 0.45
count_documentsMethod · 0.45

Tested by

no test coverage detected