@@ -14,6 +14,7 @@ import (
14
14
"strconv"
15
15
16
16
"go.mongodb.org/mongo-driver/v2/internal/mongoutil"
17
+ "go.mongodb.org/mongo-driver/v2/internal/optionsutil"
17
18
"go.mongodb.org/mongo-driver/v2/internal/serverselector"
18
19
"go.mongodb.org/mongo-driver/v2/mongo/options"
19
20
"go.mongodb.org/mongo-driver/v2/mongo/readpref"
@@ -101,6 +102,11 @@ func (iv IndexView) List(ctx context.Context, opts ...options.Lister[options.Lis
101
102
op = op .BatchSize (* args .BatchSize )
102
103
cursorOpts .BatchSize = * args .BatchSize
103
104
}
105
+ if rawDataOpt := optionsutil .Value (args .Internal , "rawData" ); rawDataOpt != nil {
106
+ if rawData , ok := rawDataOpt .(bool ); ok {
107
+ op = op .RawData (rawData )
108
+ }
109
+ }
104
110
105
111
retry := driver .RetryNone
106
112
if iv .coll .client .retryReads {
@@ -279,6 +285,11 @@ func (iv IndexView) CreateMany(
279
285
280
286
op .CommitQuorum (commitQuorum )
281
287
}
288
+ if rawDataOpt := optionsutil .Value (args .Internal , "rawData" ); rawDataOpt != nil {
289
+ if rawData , ok := rawDataOpt .(bool ); ok {
290
+ op = op .RawData (rawData )
291
+ }
292
+ }
282
293
283
294
_ , err = processWriteError (op .Execute (ctx ))
284
295
if err != nil {
@@ -376,7 +387,12 @@ func (iv IndexView) createOptionsDoc(opts options.Lister[options.IndexOptions])
376
387
return optsDoc , nil
377
388
}
378
389
379
- func (iv IndexView ) drop (ctx context.Context , index any , _ ... options.Lister [options.DropIndexesOptions ]) error {
390
+ func (iv IndexView ) drop (ctx context.Context , index any , opts ... options.Lister [options.DropIndexesOptions ]) error {
391
+ args , err := mongoutil .NewOptions [options.DropIndexesOptions ](opts ... )
392
+ if err != nil {
393
+ return fmt .Errorf ("failed to construct options from builder: %w" , err )
394
+ }
395
+
380
396
if ctx == nil {
381
397
ctx = context .Background ()
382
398
}
@@ -387,7 +403,7 @@ func (iv IndexView) drop(ctx context.Context, index any, _ ...options.Lister[opt
387
403
defer sess .EndSession ()
388
404
}
389
405
390
- err : = iv .coll .client .validSession (sess )
406
+ err = iv .coll .client .validSession (sess )
391
407
if err != nil {
392
408
return err
393
409
}
@@ -408,6 +424,12 @@ func (iv IndexView) drop(ctx context.Context, index any, _ ...options.Lister[opt
408
424
Deployment (iv .coll .client .deployment ).ServerAPI (iv .coll .client .serverAPI ).
409
425
Timeout (iv .coll .client .timeout ).Crypt (iv .coll .client .cryptFLE ).Authenticator (iv .coll .client .authenticator )
410
426
427
+ if rawDataOpt := optionsutil .Value (args .Internal , "rawData" ); rawDataOpt != nil {
428
+ if rawData , ok := rawDataOpt .(bool ); ok {
429
+ op = op .RawData (rawData )
430
+ }
431
+ }
432
+
411
433
err = op .Execute (ctx )
412
434
if err != nil {
413
435
return wrapErrors (err )
0 commit comments