@@ -800,25 +800,28 @@ public void TestUpdateUpdatesAllMatchingDocuments(bool ordered)
800800 [ TestCase ( true ) ]
801801 public void TestUpsertOneVeryLargeDocument ( bool ordered )
802802 {
803- _collection . Drop ( ) ;
803+ if ( _primary . BuildInfo . Version >= new Version ( 2 , 6 , 0 ) )
804+ {
805+ _collection . Drop ( ) ;
804806
805- var bulk = InitializeBulkOperation ( _collection , ordered ) ;
806- var bigString = new string ( 'x' , 16 * 1024 * 1024 - 30 ) ;
807- bulk . Find ( Query . EQ ( "key " , 1 ) ) . Upsert ( ) . Update ( Update . Set ( "x" , bigString ) ) ;
808- var result = bulk . Execute ( ) ;
807+ var bulk = InitializeBulkOperation ( _collection , ordered ) ;
808+ var bigString = new string ( 'x' , 16 * 1024 * 1024 - 22 ) ;
809+ bulk . Find ( Query . EQ ( "_id " , 1 ) ) . Upsert ( ) . Update ( Update . Set ( "x" , bigString ) ) ; // resulting document will be exactly 16MiB
810+ var result = bulk . Execute ( ) ;
809811
810- var expectedResult = new ExpectedResult
811- {
812- UpsertsCount = 1 ,
813- IsModifiedCountAvailable = _primary . Supports ( FeatureId . WriteCommands )
814- } ;
815- CheckExpectedResult ( expectedResult , result ) ;
812+ var expectedResult = new ExpectedResult
813+ {
814+ UpsertsCount = 1 ,
815+ IsModifiedCountAvailable = _primary . Supports ( FeatureId . WriteCommands )
816+ } ;
817+ CheckExpectedResult ( expectedResult , result ) ;
816818
817- var expectedDocuments = new BsonDocument [ ]
818- {
819- new BsonDocument { { "key" , 1 } , { "x" , bigString } }
820- } ;
821- Assert . That ( _collection . FindAll ( ) . SetFields ( Fields . Exclude ( "_id" ) ) , Is . EquivalentTo ( expectedDocuments ) ) ;
819+ var expectedDocuments = new BsonDocument [ ]
820+ {
821+ new BsonDocument { { "_id" , 1 } , { "x" , bigString } }
822+ } ;
823+ Assert . That ( _collection . FindAll ( ) , Is . EquivalentTo ( expectedDocuments ) ) ;
824+ }
822825 }
823826
824827 [ Test ]
0 commit comments