Skip to content

Commit e9c315f

Browse files
committed
WIP
1 parent f014b7d commit e9c315f

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

internal/integration/unified/collection_operation_execution.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ func executeFindOneAndDelete(ctx context.Context, operation *operation) (*operat
842842
opts.SetSort(val.Document())
843843
case "let":
844844
opts.SetLet(val.Document())
845+
case "rawData":
846+
opts.SetRawBucketsData(val.Boolean())
845847
default:
846848
return nil, fmt.Errorf("unrecognized findOneAndDelete option %q", key)
847849
}
@@ -924,6 +926,8 @@ func executeFindOneAndReplace(ctx context.Context, operation *operation) (*opera
924926
opts.SetSort(val.Document())
925927
case "upsert":
926928
opts.SetUpsert(val.Boolean())
929+
case "rawData":
930+
opts.SetRawBucketsData(val.Boolean())
927931
default:
928932
return nil, fmt.Errorf("unrecognized findOneAndReplace option %q", key)
929933
}
@@ -1016,6 +1020,8 @@ func executeFindOneAndUpdate(ctx context.Context, operation *operation) (*operat
10161020
}
10171021
case "upsert":
10181022
opts.SetUpsert(val.Boolean())
1023+
case "rawData":
1024+
opts.SetRawBucketsData(val.Boolean())
10191025
default:
10201026
return nil, fmt.Errorf("unrecognized findOneAndUpdate option %q", key)
10211027
}
@@ -1062,6 +1068,8 @@ func executeInsertMany(ctx context.Context, operation *operation) (*operationRes
10621068
documents = bsonutil.RawToInterfaces(bsonutil.RawArrayToDocuments(val.Array())...)
10631069
case "ordered":
10641070
opts.SetOrdered(val.Boolean())
1071+
case "rawData":
1072+
opts.SetRawBucketsData(val.Boolean())
10651073
default:
10661074
return nil, fmt.Errorf("unrecognized insertMany option %q", key)
10671075
}
@@ -1112,6 +1120,8 @@ func executeInsertOne(ctx context.Context, operation *operation) (*operationResu
11121120
opts.SetBypassDocumentValidation(val.Boolean())
11131121
case "comment":
11141122
opts.SetComment(val)
1123+
case "rawData":
1124+
opts.SetRawBucketsData(val.Boolean())
11151125
default:
11161126
return nil, fmt.Errorf("unrecognized insertOne option %q", key)
11171127
}
@@ -1302,6 +1312,8 @@ func executeReplaceOne(ctx context.Context, operation *operation) (*operationRes
13021312
opts.SetUpsert(val.Boolean())
13031313
case "let":
13041314
opts.SetLet(val.Document())
1315+
case "rawData":
1316+
opts.SetRawBucketsData(val.Boolean())
13051317
default:
13061318
return nil, fmt.Errorf("unrecognized replaceOne option %q", key)
13071319
}

internal/integration/unified/crud_helpers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ func createUpdateManyArguments(args bson.Raw) (*updateArguments, *options.Update
6767
}
6868
case "upsert":
6969
opts.SetUpsert(val.Boolean())
70+
case "rawData":
71+
opts.SetRawBucketsData(val.Boolean())
7072
default:
7173
return nil, nil, fmt.Errorf("unrecognized update option %q", key)
7274
}
@@ -125,6 +127,8 @@ func createUpdateOneArguments(args bson.Raw) (*updateArguments, *options.UpdateO
125127
opts.SetUpsert(val.Boolean())
126128
case "sort":
127129
opts.SetSort(val.Document())
130+
case "rawData":
131+
opts.SetRawBucketsData(val.Boolean())
128132
default:
129133
return nil, nil, fmt.Errorf("unrecognized update option %q", key)
130134
}

x/mongo/driver/operation/find.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ func (f *Find) command(dst []byte, desc description.SelectedServer) ([]byte, err
192192
if f.tailable != nil {
193193
dst = bsoncore.AppendBooleanElement(dst, "tailable", *f.tailable)
194194
}
195-
if f.rawBucketsData != nil {
195+
// Set rawData for 8.2+ servers.
196+
if f.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
196197
dst = bsoncore.AppendBooleanElement(dst, "rawData", *f.rawBucketsData)
197198
}
198199
return dst, nil

x/mongo/driver/operation/find_and_modify.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ func (fam *FindAndModify) command(dst []byte, desc description.SelectedServer) (
212212
if fam.let != nil {
213213
dst = bsoncore.AppendDocumentElement(dst, "let", fam.let)
214214
}
215-
if fam.rawBucketsData != nil {
215+
// Set rawData for 8.2+ servers.
216+
if fam.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
216217
dst = bsoncore.AppendBooleanElement(dst, "rawData", *fam.rawBucketsData)
217218
}
218219

x/mongo/driver/operation/insert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ func (i *Insert) command(dst []byte, desc description.SelectedServer) ([]byte, e
133133
if i.ordered != nil {
134134
dst = bsoncore.AppendBooleanElement(dst, "ordered", *i.ordered)
135135
}
136-
if i.rawBucketsData != nil {
136+
// Set rawData for 8.2+ servers.
137+
if i.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
137138
dst = bsoncore.AppendBooleanElement(dst, "rawData", *i.rawBucketsData)
138139
}
139140
return dst, nil

x/mongo/driver/operation/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ func (u *Update) command(dst []byte, desc description.SelectedServer) ([]byte, e
204204
if u.let != nil {
205205
dst = bsoncore.AppendDocumentElement(dst, "let", u.let)
206206
}
207-
if u.rawBucketsData != nil {
207+
// Set rawData for 8.2+ servers.
208+
if u.rawBucketsData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) {
208209
dst = bsoncore.AppendBooleanElement(dst, "rawData", *u.rawBucketsData)
209210
}
210211

0 commit comments

Comments
 (0)