Skip to content

Commit 43d255b

Browse files
committed
WIP
1 parent 106c333 commit 43d255b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

internal/integration/unified/client_operation_execution.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ func executeClientBulkWrite(ctx context.Context, operation *operation) (*operati
235235
return nil, err
236236
}
237237
opts.SetWriteConcern(c)
238+
case "rawData":
239+
opts.SetRawBucketsData(val.Boolean())
238240
default:
239241
return nil, fmt.Errorf("unrecognized bulkWrite option %q", key)
240242
}

internal/integration/unified/collection_operation_execution.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ func executeAggregate(ctx context.Context, operation *operation) (*operationResu
7575
pipeline = bsonutil.RawToInterfaces(bsonutil.RawArrayToDocuments(val.Array())...)
7676
case "let":
7777
opts.SetLet(val.Document())
78+
case "rawData":
79+
opts.SetRawBucketsData(val.Boolean())
7880
default:
7981
return nil, fmt.Errorf("unrecognized aggregate option %q", key)
8082
}
@@ -125,6 +127,8 @@ func executeBulkWrite(ctx context.Context, operation *operation) (*operationResu
125127
}
126128
case "let":
127129
opts.SetLet(val.Document())
130+
case "rawData":
131+
opts.SetRawBucketsData(val.Boolean())
128132
default:
129133
return nil, fmt.Errorf("unrecognized bulkWrite option %q", key)
130134
}
@@ -202,6 +206,8 @@ func executeCountDocuments(ctx context.Context, operation *operation) (*operatio
202206
return nil, fmt.Errorf("the maxTimeMS collection option is not supported")
203207
case "skip":
204208
opts.SetSkip(int64(val.Int32()))
209+
case "rawData":
210+
opts.SetRawBucketsData(val.Boolean())
205211
default:
206212
return nil, fmt.Errorf("unrecognized countDocuments option %q", key)
207213
}
@@ -696,6 +702,8 @@ func executeEstimatedDocumentCount(ctx context.Context, operation *operation) (*
696702
// ensured an analogue exists, extend "skippedTestDescriptions" to avoid
697703
// this error.
698704
return nil, fmt.Errorf("the maxTimeMS collection option is not supported")
705+
case "rawData":
706+
opts.SetRawBucketsData(val.Boolean())
699707
default:
700708
return nil, fmt.Errorf("unrecognized estimatedDocumentCount option %q", key)
701709
}

x/mongo/driver/operation/aggregate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ func (a *Aggregate) command(dst []byte, desc description.SelectedServer) ([]byte
160160
if a.let != nil {
161161
dst = bsoncore.AppendDocumentElement(dst, "let", a.let)
162162
}
163-
if a.rawBucketsData != nil {
163+
// Set rawData for 8.2+ servers.
164+
if a.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
164165
dst = bsoncore.AppendBooleanElement(dst, "rawData", *a.rawBucketsData)
165166
}
166167
for optionName, optionValue := range a.customOptions {

x/mongo/driver/operation/count.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,16 @@ func (c *Count) Execute(ctx context.Context) error {
140140
return err
141141
}
142142

143-
func (c *Count) command(dst []byte, _ description.SelectedServer) ([]byte, error) {
143+
func (c *Count) command(dst []byte, desc description.SelectedServer) ([]byte, error) {
144144
dst = bsoncore.AppendStringElement(dst, "count", c.collection)
145145
if c.query != nil {
146146
dst = bsoncore.AppendDocumentElement(dst, "query", c.query)
147147
}
148148
if c.comment.Type != bsoncore.Type(0) {
149149
dst = bsoncore.AppendValueElement(dst, "comment", c.comment)
150150
}
151-
if c.rawBucketsData != nil {
151+
// Set rawData for 8.2+ servers.
152+
if c.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
152153
dst = bsoncore.AppendBooleanElement(dst, "rawData", *c.rawBucketsData)
153154
}
154155
return dst, nil

0 commit comments

Comments
 (0)