Skip to content

Commit b93a446

Browse files
committed
WIP
1 parent 106c333 commit b93a446

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

internal/integration/unified/collection_operation_execution.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ func executeBulkWrite(ctx context.Context, operation *operation) (*operationResu
125125
}
126126
case "let":
127127
opts.SetLet(val.Document())
128+
case "rawData":
129+
opts.SetRawBucketsData(val.Boolean())
128130
default:
129131
return nil, fmt.Errorf("unrecognized bulkWrite option %q", key)
130132
}
@@ -202,6 +204,8 @@ func executeCountDocuments(ctx context.Context, operation *operation) (*operatio
202204
return nil, fmt.Errorf("the maxTimeMS collection option is not supported")
203205
case "skip":
204206
opts.SetSkip(int64(val.Int32()))
207+
case "rawData":
208+
opts.SetRawBucketsData(val.Boolean())
205209
default:
206210
return nil, fmt.Errorf("unrecognized countDocuments option %q", key)
207211
}
@@ -696,6 +700,8 @@ func executeEstimatedDocumentCount(ctx context.Context, operation *operation) (*
696700
// ensured an analogue exists, extend "skippedTestDescriptions" to avoid
697701
// this error.
698702
return nil, fmt.Errorf("the maxTimeMS collection option is not supported")
703+
case "rawData":
704+
opts.SetRawBucketsData(val.Boolean())
699705
default:
700706
return nil, fmt.Errorf("unrecognized estimatedDocumentCount option %q", key)
701707
}

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)