@@ -563,10 +563,13 @@ First, perform the setup.
5635632. Using ` client ` , drop and create the collection ` db.coll ` configured with the included JSON schema
564564 [limits / limits - schema .json ](../ limits / limits - schema .json ).
565565
566- 3. Using ` client ` , drop the collection ` keyvault.datakeys ` . Insert the document
566+ 3. If using MongoDB 8.0 + , use ` client ` to drop and create the collection ` db.coll2 ` configured with the included
567+ encryptedFields [limits / limits - encryptedFields .json ](../ limits / limits - encryptedFields .json ).
568+
569+ 4. Using ` client ` , drop the collection ` keyvault.datakeys ` . Insert the document
567570 [limits / limits - key .json ](../ limits / limits - key .json )
568571
569- 4 . Create a MongoClient configured with auto encryption (referred to as ` client_encrypted ` )
572+ 5 . Create a MongoClient configured with auto encryption (referred to as ` client_encrypted ` )
570573
571574 Configure with the ` local ` KMS provider as follows :
572575
@@ -578,27 +581,27 @@ First, perform the setup.
578581
579582Using ` client_encrypted ` perform the following operations :
580583
581- 1. Insert ` { "_id": "over_2mib_under_16mib", "unencrypted": <the string "a" repeated 2097152 times> } ` .
584+ 1. Insert ` { "_id": "over_2mib_under_16mib", "unencrypted": <the string "a" repeated 2097152 times> } ` into ` coll ` .
582585
583586 Expect this to succeed since this is still under the ` maxBsonObjectSize ` limit .
584587
5855882. Insert the document [limits / limits - doc .json ](../ limits / limits - doc .json ) concatenated with
586- ` { "_id": "encryption_exceeds_2mib", "unencrypted": < the string "a" repeated (2097152 - 2000) times > } ` Note :
587- limits - doc .json is a 1005 byte BSON document that encrypts to a ~ 10 ,000 byte document .
589+ ` { "_id": "encryption_exceeds_2mib", "unencrypted": < the string "a" repeated (2097152 - 2000) times > } ` into
590+ ` coll ` . Note : limits - doc .json is a 1005 byte BSON document that encrypts to a ~ 10 ,000 byte document .
588591
589592 Expect this to succeed since after encryption this still is below the normal maximum BSON document size . Note , before
590593 auto encryption this document is under the 2 MiB limit . After encryption it exceeds the 2 MiB limit , but does NOT
591594 exceed the 16 MiB limit .
592595
593- 3. Bulk insert the following :
596+ 3. Use MongoCollection . bulkWrite to insert the following into ` coll ` :
594597
595598 - ` { "_id": "over_2mib_1", "unencrypted": <the string "a" repeated (2097152) times> } `
596599 - ` { "_id": "over_2mib_2", "unencrypted": <the string "a" repeated (2097152) times> } `
597600
598601 Expect the bulk write to succeed and split after first doc (i .e . two inserts occur ). This may be verified using
599602 [command monitoring ](../ ../ command - logging - and - monitoring / command - logging - and - monitoring .md ).
600603
601- 4. Bulk insert the following :
604+ 4. Use MongoCollection . bulkWrite insert the following into ` coll ` :
602605
603606 - The document [limits / limits - doc .json ](../ limits / limits - doc .json ) concatenated with
604607 ` { "_id": "encryption_exceeds_2mib_1", "unencrypted": < the string "a" repeated (2097152 - 2000) times > } `
@@ -608,15 +611,34 @@ Using `client_encrypted` perform the following operations:
608611 Expect the bulk write to succeed and split after first doc (i .e . two inserts occur ). This may be verified using
609612 [command logging and monitoring ](../ ../ command - logging - and - monitoring / command - logging - and - monitoring .md ).
610613
611- 5. Insert ` { "_id": "under_16mib", "unencrypted": <the string "a" repeated 16777216 - 2000 times> ` .
614+ 5. Insert ` { "_id": "under_16mib", "unencrypted": <the string "a" repeated 16777216 - 2000 times> ` into ` coll ` .
612615
613616 Expect this to succeed since this is still (just ) under the ` maxBsonObjectSize ` limit .
614617
6156186. Insert the document [limits / limits - doc .json ](../ limits / limits - doc .json ) concatenated with
616- ` { "_id": "encryption_exceeds_16mib", "unencrypted": < the string "a" repeated (16777216 - 2000) times > } `
619+ ` { "_id": "encryption_exceeds_16mib", "unencrypted": < the string "a" repeated (16777216 - 2000) times > } ` into
620+ ` coll ` .
617621
618622 Expect this to fail since encryption results in a document exceeding the ` maxBsonObjectSize ` limit .
619623
624+ 7. If using MongoDB 8.0 + , use MongoClient .bulkWrite to insert the following into ` coll2 ` :
625+
626+ - ` { "_id": "over_2mib_3", "unencrypted": <the string "a" repeated (2097152 - 1500) times> } `
627+ - ` { "_id": "over_2mib_4", "unencrypted": <the string "a" repeated (2097152 - 1500) times> } `
628+
629+ Expect the bulk write to succeed and split after first doc (i .e . two inserts occur ). This may be verified using
630+ [command logging and monitoring ](../ ../ command - logging - and - monitoring / command - logging - and - monitoring .md ).
631+
632+ 8. If using MongoDB 8.0 + , use MongoClient .bulkWrite to insert the following into ` coll2 ` :
633+
634+ - The document [limits / limits - qe - doc .json ](../ limits / limits - qe - doc .json ) concatenated with
635+ ` { "_id": "encryption_exceeds_2mib_3", "foo": < the string "a" repeated (2097152 - 2000 - 1500) times > } `
636+ - The document [limits / limits - qe - doc .json ](../ limits / limits - qe - doc .json ) concatenated with
637+ ` { "_id": "encryption_exceeds_2mib_4", "foo": < the string "a" repeated (2097152 - 2000 - 1500) times > } `
638+
639+ Expect the bulk write to succeed and split after first doc (i .e . two inserts occur ). This may be verified using
640+ [command logging and monitoring ](../ ../ command - logging - and - monitoring / command - logging - and - monitoring .md ).
641+
620642Optionally , if it is possible to mock the maxWriteBatchSize (i .e . the maximum number of documents in a batch ) test that
621643setting maxWriteBatchSize = 1 and inserting the two documents ` { "_id": "a" }, { "_id": "b" } ` with ` client_encrypted `
622644splits the operation into two inserts .
0 commit comments