Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Oct 12, 2024
1 parent 9782fe1 commit d2d8a49
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions x/mongo/driver/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1439,26 +1439,31 @@ func (op Operation) addEncryptCommandFields(dst []byte, desc description.Selecte
if err != nil {
return 0, nil, err
}
if op.Batches == nil {
return 0, dst, nil
}
maxBatchCount := int(desc.MaxBatchCount)
maxDocumentSize := int(desc.MaxDocumentSize)
var n int
if maxBatchCount > 1 {
if op.Batches != nil {
maxBatchCount := int(desc.MaxBatchCount)
maxDocumentSize := int(desc.MaxDocumentSize)
n, dst, err = op.Batches.AppendBatchArray(dst, maxBatchCount, cryptMaxBsonObjectSize, maxDocumentSize)
if err != nil {
return 0, nil, err
}
}
if n == 0 {
n, dst, err = op.Batches.AppendBatchArray(dst, 1, maxDocumentSize, maxDocumentSize)
if err != nil {
return 0, nil, err
}
if n == 0 {
return 0, nil, ErrDocumentTooLarge
}
/*
if maxBatchCount > 1 {
n, dst, err = op.Batches.AppendBatchArray(dst, maxBatchCount, cryptMaxBsonObjectSize, maxDocumentSize)
if err != nil {
return 0, nil, err
}
}
if n == 0 {
n, dst, err = op.Batches.AppendBatchArray(dst, 1, maxDocumentSize, maxDocumentSize)
if err != nil {
return 0, nil, err
}
if n == 0 {
return 0, nil, ErrDocumentTooLarge
}
}
*/
}
dst, err = bsoncore.AppendDocumentEnd(dst, idx)
if err != nil {
Expand Down

0 comments on commit d2d8a49

Please sign in to comment.