@@ -191,6 +191,8 @@ type modelBatches struct {
191191 writeErrors map [int ]WriteError
192192}
193193
194+ var _ driver.OperationBatches = & modelBatches {}
195+
194196func (mb * modelBatches ) IsOrdered () * bool {
195197 return & mb .ordered
196198}
@@ -209,7 +211,7 @@ func (mb *modelBatches) Size() int {
209211 return len (mb .models ) - mb .offset
210212}
211213
212- func (mb * modelBatches ) AppendBatchSequence (dst []byte , maxCount , maxDocSize , totalSize int ) (int , []byte , error ) {
214+ func (mb * modelBatches ) AppendBatchSequence (dst []byte , maxCount , totalSize int ) (int , []byte , error ) {
213215 fn := functionSet {
214216 appendStart : func (dst []byte , identifier string ) (int32 , []byte ) {
215217 var idx int32
@@ -228,10 +230,10 @@ func (mb *modelBatches) AppendBatchSequence(dst []byte, maxCount, maxDocSize, to
228230 return dst
229231 },
230232 }
231- return mb .appendBatches (fn , dst , maxCount , maxDocSize , totalSize )
233+ return mb .appendBatches (fn , dst , maxCount , totalSize )
232234}
233235
234- func (mb * modelBatches ) AppendBatchArray (dst []byte , maxCount , maxDocSize , totalSize int ) (int , []byte , error ) {
236+ func (mb * modelBatches ) AppendBatchArray (dst []byte , maxCount , totalSize int ) (int , []byte , error ) {
235237 fn := functionSet {
236238 appendStart : bsoncore .AppendArrayElementStart ,
237239 appendDocument : bsoncore .AppendDocumentElement ,
@@ -240,7 +242,7 @@ func (mb *modelBatches) AppendBatchArray(dst []byte, maxCount, maxDocSize, total
240242 return dst
241243 },
242244 }
243- return mb .appendBatches (fn , dst , maxCount , maxDocSize , totalSize )
245+ return mb .appendBatches (fn , dst , maxCount , totalSize )
244246}
245247
246248type functionSet struct {
@@ -249,7 +251,7 @@ type functionSet struct {
249251 updateLength func ([]byte , int32 , int32 ) []byte
250252}
251253
252- func (mb * modelBatches ) appendBatches (fn functionSet , dst []byte , maxCount , maxDocSize , totalSize int ) (int , []byte , error ) {
254+ func (mb * modelBatches ) appendBatches (fn functionSet , dst []byte , maxCount , totalSize int ) (int , []byte , error ) {
253255 if mb .Size () == 0 {
254256 return 0 , dst , io .EOF
255257 }
@@ -269,7 +271,7 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
269271 }
270272
271273 canRetry := true
272- checkSize := true
274+ // checkSize := true
273275
274276 l := len (dst )
275277
@@ -291,13 +293,13 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
291293 var err error
292294 switch model := mb .models [i ].model .(type ) {
293295 case * ClientInsertOneModel :
294- checkSize = false
296+ // checkSize = false
295297 mb .cursorHandlers = append (mb .cursorHandlers , mb .appendInsertResult )
296298 var id interface {}
297299 id , doc , err = (& clientInsertDoc {
298300 namespace : nsIdx ,
299301 document : model .Document ,
300- sizeLimit : maxDocSize ,
302+ // sizeLimit: maxDocSize,
301303 }).marshal (mb .client .bsonOpts , mb .client .registry )
302304 if err != nil {
303305 break
@@ -331,7 +333,7 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
331333 checkDollarKey : true ,
332334 }).marshal (mb .client .bsonOpts , mb .client .registry )
333335 case * ClientReplaceOneModel :
334- checkSize = false
336+ // checkSize = false
335337 mb .cursorHandlers = append (mb .cursorHandlers , mb .appendUpdateResult )
336338 doc , err = (& clientUpdateDoc {
337339 namespace : nsIdx ,
@@ -343,7 +345,7 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
343345 upsert : model .Upsert ,
344346 multi : false ,
345347 checkDollarKey : false ,
346- sizeLimit : maxDocSize ,
348+ // sizeLimit: maxDocSize,
347349 }).marshal (mb .client .bsonOpts , mb .client .registry )
348350 case * ClientDeleteOneModel :
349351 mb .cursorHandlers = append (mb .cursorHandlers , mb .appendDeleteResult )
@@ -371,9 +373,9 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
371373 return 0 , nil , err
372374 }
373375 length := len (doc )
374- if maxDocSize > 0 && length > maxDocSize + 16 * 1024 {
375- return 0 , nil , driver .ErrDocumentTooLarge
376- }
376+ // if maxDocSize > 0 && length > maxDocSize+16*1024 {
377+ // return 0, nil, driver.ErrDocumentTooLarge
378+ // }
377379 if ! exists {
378380 length += len (ns )
379381 }
@@ -398,9 +400,9 @@ func (mb *modelBatches) appendBatches(fn functionSet, dst []byte, maxCount, maxD
398400 dst = fn .updateLength (dst , opsIdx , int32 (len (dst [opsIdx :])))
399401 nsDst = fn .updateLength (nsDst , nsIdx , int32 (len (nsDst [nsIdx :])))
400402 dst = append (dst , nsDst ... )
401- if checkSize && maxDocSize > 0 && len (dst )- l > maxDocSize + 16 * 1024 {
402- return 0 , nil , driver .ErrDocumentTooLarge
403- }
403+ // if checkSize && maxDocSize > 0 && len(dst)-l > maxDocSize+16*1024 {
404+ // return 0, nil, driver.ErrDocumentTooLarge
405+ // }
404406
405407 mb .retryMode = driver .RetryNone
406408 if mb .client .retryWrites && canRetry {
@@ -585,7 +587,7 @@ type clientInsertDoc struct {
585587 namespace int
586588 document interface {}
587589
588- sizeLimit int
590+ // sizeLimit int
589591}
590592
591593func (d * clientInsertDoc ) marshal (bsonOpts * options.BSONOptions , registry * bson.Registry ) (interface {}, bsoncore.Document , error ) {
@@ -596,9 +598,9 @@ func (d *clientInsertDoc) marshal(bsonOpts *options.BSONOptions, registry *bson.
596598 if err != nil {
597599 return nil , nil , err
598600 }
599- if d .sizeLimit > 0 && len (f ) > d .sizeLimit {
600- return nil , nil , driver .ErrDocumentTooLarge
601- }
601+ // if d.sizeLimit > 0 && len(f) > d.sizeLimit {
602+ // return nil, nil, driver.ErrDocumentTooLarge
603+ // }
602604 var id interface {}
603605 f , id , err = ensureID (f , bson .NilObjectID , bsonOpts , registry )
604606 if err != nil {
@@ -620,7 +622,7 @@ type clientUpdateDoc struct {
620622 multi bool
621623 checkDollarKey bool
622624
623- sizeLimit int
625+ // sizeLimit int
624626}
625627
626628func (d * clientUpdateDoc ) marshal (bsonOpts * options.BSONOptions , registry * bson.Registry ) (bsoncore.Document , error ) {
@@ -641,9 +643,9 @@ func (d *clientUpdateDoc) marshal(bsonOpts *options.BSONOptions, registry *bson.
641643 if err != nil {
642644 return nil , err
643645 }
644- if d .sizeLimit > 0 && len (u .Data ) > d .sizeLimit {
645- return nil , driver .ErrDocumentTooLarge
646- }
646+ // if d.sizeLimit > 0 && len(u.Data) > d.sizeLimit {
647+ // return nil, driver.ErrDocumentTooLarge
648+ // }
647649 doc = bsoncore .AppendValueElement (doc , "updateMods" , u )
648650 doc = bsoncore .AppendBooleanElement (doc , "multi" , d .multi )
649651
0 commit comments