diff --git a/internal/integration/unified/client_operation_execution.go b/internal/integration/unified/client_operation_execution.go index 75948ff8a0..432852dd71 100644 --- a/internal/integration/unified/client_operation_execution.go +++ b/internal/integration/unified/client_operation_execution.go @@ -19,6 +19,7 @@ import ( "go.mongodb.org/mongo-driver/v2/mongo" "go.mongodb.org/mongo-driver/v2/mongo/options" "go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore" + "go.mongodb.org/mongo-driver/v2/x/mongo/driver/xoptions" ) // This file contains helpers to execute client operations. @@ -235,6 +236,11 @@ func executeClientBulkWrite(ctx context.Context, operation *operation) (*operati return nil, err } opts.SetWriteConcern(c) + case "rawData": + err = xoptions.SetInternalClientBulkWriteOptions(opts, key, val.Boolean()) + if err != nil { + return nil, err + } default: return nil, fmt.Errorf("unrecognized bulkWrite option %q", key) } diff --git a/internal/integration/unified/collection_operation_execution.go b/internal/integration/unified/collection_operation_execution.go index be9afe0cd7..26537bce7e 100644 --- a/internal/integration/unified/collection_operation_execution.go +++ b/internal/integration/unified/collection_operation_execution.go @@ -241,6 +241,7 @@ func executeCreateIndex(ctx context.Context, operation *operation) (*operationRe var keys bson.Raw indexOpts := options.Index() + opts := options.CreateIndexes() elems, err := operation.Arguments.Elements() if err != nil { @@ -295,6 +296,11 @@ func executeCreateIndex(ctx context.Context, operation *operation) (*operationRe indexOpts.SetWeights(val.Document()) case "wildcardProjection": indexOpts.SetWildcardProjection(val.Document()) + case "rawData": + err = xoptions.SetInternalCreateIndexesOptions(opts, key, val.Boolean()) + if err != nil { + return nil, err + } default: return nil, fmt.Errorf("unrecognized createIndex option %q", key) } @@ -307,7 +313,8 @@ func executeCreateIndex(ctx context.Context, operation *operation) (*operationRe Keys: keys, Options: indexOpts, } - name, err := coll.Indexes().CreateOne(ctx, model) + + name, err := coll.Indexes().CreateOne(ctx, model, opts) return newValueResult(bson.TypeString, bsoncore.AppendString(nil, name), err), nil } @@ -624,6 +631,11 @@ func executeDropIndex(ctx context.Context, operation *operation) (*operationResu // ensured an analogue exists, extend "skippedTestDescriptions" to avoid // this error. return nil, fmt.Errorf("the maxTimeMS collection option is not supported") + case "rawData": + err = xoptions.SetInternalDropIndexesOptions(dropIndexOpts, key, val.Boolean()) + if err != nil { + return nil, err + } default: return nil, fmt.Errorf("unrecognized dropIndex option %q", key) } @@ -1217,6 +1229,11 @@ func executeListIndexes(ctx context.Context, operation *operation) (*operationRe switch key { case "batchSize": opts.SetBatchSize(val.Int32()) + case "rawData": + err = xoptions.SetInternalListIndexesOptions(opts, key, val.Boolean()) + if err != nil { + return nil, err + } default: return nil, fmt.Errorf("unrecognized listIndexes option: %q", key) } diff --git a/internal/integration/unified/crud_helpers.go b/internal/integration/unified/crud_helpers.go index 98719224c4..f24e1f9be7 100644 --- a/internal/integration/unified/crud_helpers.go +++ b/internal/integration/unified/crud_helpers.go @@ -173,6 +173,11 @@ func createListCollectionsArguments(args bson.Raw) (*listCollectionsArguments, e lca.filter = val.Document() case "nameOnly": lca.opts.SetNameOnly(val.Boolean()) + case "rawData": + err := xoptions.SetInternalListCollectionsOptions(lca.opts, key, val.Boolean()) + if err != nil { + return nil, err + } default: return nil, fmt.Errorf("unrecognized listCollections option %q", key) } diff --git a/mongo/client.go b/mongo/client.go index 885246a211..9140e178af 100644 --- a/mongo/client.go +++ b/mongo/client.go @@ -18,6 +18,7 @@ import ( "go.mongodb.org/mongo-driver/v2/internal/httputil" "go.mongodb.org/mongo-driver/v2/internal/logger" "go.mongodb.org/mongo-driver/v2/internal/mongoutil" + "go.mongodb.org/mongo-driver/v2/internal/optionsutil" "go.mongodb.org/mongo-driver/v2/internal/ptrutil" "go.mongodb.org/mongo-driver/v2/internal/serverselector" "go.mongodb.org/mongo-driver/v2/internal/uuid" @@ -957,6 +958,11 @@ func (c *Client) BulkWrite(ctx context.Context, writes []ClientBulkWrite, selector: selector, writeConcern: wc, } + if rawDataOpt := optionsutil.Value(bwo.Internal, "rawData"); rawDataOpt != nil { + if rawData, ok := rawDataOpt.(bool); ok { + op.rawData = &rawData + } + } if bwo.VerboseResults == nil || !(*bwo.VerboseResults) { op.errorsOnly = true } else if !acknowledged { diff --git a/mongo/client_bulk_write.go b/mongo/client_bulk_write.go index ca6ecf5240..7a0d557881 100644 --- a/mongo/client_bulk_write.go +++ b/mongo/client_bulk_write.go @@ -44,6 +44,7 @@ type clientBulkWrite struct { client *Client selector description.ServerSelector writeConcern *writeconcern.WriteConcern + rawData *bool result ClientBulkWriteResult } @@ -143,6 +144,10 @@ func (bw *clientBulkWrite) newCommand() func([]byte, description.SelectedServer) } dst = bsoncore.AppendDocumentElement(dst, "let", let) } + // Set rawData for 8.2+ servers. + if bw.rawData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) { + dst = bsoncore.AppendBooleanElement(dst, "rawData", *bw.rawData) + } return dst, nil } } diff --git a/mongo/database.go b/mongo/database.go index a3269ddf16..8476aeb201 100644 --- a/mongo/database.go +++ b/mongo/database.go @@ -16,6 +16,7 @@ import ( "go.mongodb.org/mongo-driver/v2/internal/csfle" "go.mongodb.org/mongo-driver/v2/internal/csot" "go.mongodb.org/mongo-driver/v2/internal/mongoutil" + "go.mongodb.org/mongo-driver/v2/internal/optionsutil" "go.mongodb.org/mongo-driver/v2/internal/serverselector" "go.mongodb.org/mongo-driver/v2/mongo/options" "go.mongodb.org/mongo-driver/v2/mongo/readconcern" @@ -487,6 +488,11 @@ func (db *Database) ListCollections( if args.AuthorizedCollections != nil { op = op.AuthorizedCollections(*args.AuthorizedCollections) } + if rawDataOpt := optionsutil.Value(args.Internal, "rawData"); rawDataOpt != nil { + if rawData, ok := rawDataOpt.(bool); ok { + op = op.RawData(rawData) + } + } retry := driver.RetryNone if db.client.retryReads { diff --git a/mongo/index_view.go b/mongo/index_view.go index a0734ebf16..7198c4cc43 100644 --- a/mongo/index_view.go +++ b/mongo/index_view.go @@ -14,6 +14,7 @@ import ( "strconv" "go.mongodb.org/mongo-driver/v2/internal/mongoutil" + "go.mongodb.org/mongo-driver/v2/internal/optionsutil" "go.mongodb.org/mongo-driver/v2/internal/serverselector" "go.mongodb.org/mongo-driver/v2/mongo/options" "go.mongodb.org/mongo-driver/v2/mongo/readpref" @@ -101,6 +102,11 @@ func (iv IndexView) List(ctx context.Context, opts ...options.Lister[options.Lis op = op.BatchSize(*args.BatchSize) cursorOpts.BatchSize = *args.BatchSize } + if rawDataOpt := optionsutil.Value(args.Internal, "rawData"); rawDataOpt != nil { + if rawData, ok := rawDataOpt.(bool); ok { + op = op.RawData(rawData) + } + } retry := driver.RetryNone if iv.coll.client.retryReads { @@ -279,6 +285,11 @@ func (iv IndexView) CreateMany( op.CommitQuorum(commitQuorum) } + if rawDataOpt := optionsutil.Value(args.Internal, "rawData"); rawDataOpt != nil { + if rawData, ok := rawDataOpt.(bool); ok { + op = op.RawData(rawData) + } + } _, err = processWriteError(op.Execute(ctx)) if err != nil { @@ -376,7 +387,12 @@ func (iv IndexView) createOptionsDoc(opts options.Lister[options.IndexOptions]) return optsDoc, nil } -func (iv IndexView) drop(ctx context.Context, index any, _ ...options.Lister[options.DropIndexesOptions]) error { +func (iv IndexView) drop(ctx context.Context, index any, opts ...options.Lister[options.DropIndexesOptions]) error { + args, err := mongoutil.NewOptions[options.DropIndexesOptions](opts...) + if err != nil { + return fmt.Errorf("failed to construct options from builder: %w", err) + } + if ctx == nil { ctx = context.Background() } @@ -387,7 +403,7 @@ func (iv IndexView) drop(ctx context.Context, index any, _ ...options.Lister[opt defer sess.EndSession() } - err := iv.coll.client.validSession(sess) + err = iv.coll.client.validSession(sess) if err != nil { return err } @@ -408,6 +424,12 @@ func (iv IndexView) drop(ctx context.Context, index any, _ ...options.Lister[opt Deployment(iv.coll.client.deployment).ServerAPI(iv.coll.client.serverAPI). Timeout(iv.coll.client.timeout).Crypt(iv.coll.client.cryptFLE).Authenticator(iv.coll.client.authenticator) + if rawDataOpt := optionsutil.Value(args.Internal, "rawData"); rawDataOpt != nil { + if rawData, ok := rawDataOpt.(bool); ok { + op = op.RawData(rawData) + } + } + err = op.Execute(ctx) if err != nil { return wrapErrors(err) diff --git a/mongo/options/clientbulkwriteoptions.go b/mongo/options/clientbulkwriteoptions.go index a55ac27f05..fd6933822b 100644 --- a/mongo/options/clientbulkwriteoptions.go +++ b/mongo/options/clientbulkwriteoptions.go @@ -7,6 +7,7 @@ package options import ( + "go.mongodb.org/mongo-driver/v2/internal/optionsutil" "go.mongodb.org/mongo-driver/v2/mongo/writeconcern" ) @@ -20,6 +21,10 @@ type ClientBulkWriteOptions struct { Let interface{} WriteConcern *writeconcern.WriteConcern VerboseResults *bool + + // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any + // release. + Internal optionsutil.Options } // ClientBulkWriteOptionsBuilder contains options to configure client-level bulk diff --git a/mongo/options/indexoptions.go b/mongo/options/indexoptions.go index b7b61c2edf..792bd827a7 100644 --- a/mongo/options/indexoptions.go +++ b/mongo/options/indexoptions.go @@ -6,12 +6,18 @@ package options +import "go.mongodb.org/mongo-driver/v2/internal/optionsutil" + // CreateIndexesOptions represents arguments that can be used to configure // IndexView.CreateOne and IndexView.CreateMany operations. // // See corresponding setter methods for documentation. type CreateIndexesOptions struct { CommitQuorum interface{} + + // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any + // release. + Internal optionsutil.Options } // CreateIndexesOptionsBuilder contains options to create indexes. Each option @@ -121,7 +127,11 @@ func (c *CreateIndexesOptionsBuilder) SetCommitQuorumVotingMembers() *CreateInde // DropIndexesOptions represents arguments that can be used to configure // IndexView.DropOne and IndexView.DropAll operations. -type DropIndexesOptions struct{} +type DropIndexesOptions struct { + // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any + // release. + Internal optionsutil.Options +} // DropIndexesOptionsBuilder contains options to configure dropping indexes. // Each option can be set through setter functions. See documentation for each @@ -146,6 +156,10 @@ func (d *DropIndexesOptionsBuilder) List() []func(*DropIndexesOptions) error { // See corresponding setter methods for documentation. type ListIndexesOptions struct { BatchSize *int32 + + // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any + // release. + Internal optionsutil.Options } // ListIndexesOptionsBuilder contains options to configure count operations. Each diff --git a/mongo/options/listcollectionsoptions.go b/mongo/options/listcollectionsoptions.go index 2106b2f906..14f96cc627 100644 --- a/mongo/options/listcollectionsoptions.go +++ b/mongo/options/listcollectionsoptions.go @@ -6,6 +6,8 @@ package options +import "go.mongodb.org/mongo-driver/v2/internal/optionsutil" + // ListCollectionsOptions represents arguments that can be used to configure a // ListCollections operation. // @@ -14,6 +16,10 @@ type ListCollectionsOptions struct { NameOnly *bool BatchSize *int32 AuthorizedCollections *bool + + // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any + // release. + Internal optionsutil.Options } // ListCollectionsOptionsBuilder contains options to configure list collection diff --git a/x/mongo/driver/operation/create_indexes.go b/x/mongo/driver/operation/create_indexes.go index 0380a55a26..17e88ba8c8 100644 --- a/x/mongo/driver/operation/create_indexes.go +++ b/x/mongo/driver/operation/create_indexes.go @@ -38,6 +38,7 @@ type CreateIndexes struct { result CreateIndexesResult serverAPI *driver.ServerAPIOptions timeout *time.Duration + rawData *bool } // CreateIndexesResult represents a createIndexes result returned by the server. @@ -133,6 +134,10 @@ func (ci *CreateIndexes) command(dst []byte, desc description.SelectedServer) ([ if ci.indexes != nil { dst = bsoncore.AppendArrayElement(dst, "indexes", ci.indexes) } + // Set rawData for 8.2+ servers. + if ci.rawData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) { + dst = bsoncore.AppendBooleanElement(dst, "rawData", *ci.rawData) + } return dst, nil } @@ -277,3 +282,13 @@ func (ci *CreateIndexes) Authenticator(authenticator driver.Authenticator) *Crea ci.authenticator = authenticator return ci } + +// RawData sets the rawData to access timeseries data in the compressed format. +func (ci *CreateIndexes) RawData(rawData bool) *CreateIndexes { + if ci == nil { + ci = new(CreateIndexes) + } + + ci.rawData = &rawData + return ci +} diff --git a/x/mongo/driver/operation/drop_indexes.go b/x/mongo/driver/operation/drop_indexes.go index e57cff72ee..14ecbdc1a9 100644 --- a/x/mongo/driver/operation/drop_indexes.go +++ b/x/mongo/driver/operation/drop_indexes.go @@ -37,6 +37,7 @@ type DropIndexes struct { result DropIndexesResult serverAPI *driver.ServerAPIOptions timeout *time.Duration + rawData *bool } // DropIndexesResult represents a dropIndexes result returned by the server. @@ -104,7 +105,7 @@ func (di *DropIndexes) Execute(ctx context.Context) error { } -func (di *DropIndexes) command(dst []byte, _ description.SelectedServer) ([]byte, error) { +func (di *DropIndexes) command(dst []byte, desc description.SelectedServer) ([]byte, error) { dst = bsoncore.AppendStringElement(dst, "dropIndexes", di.collection) switch t := di.index.(type) { @@ -115,6 +116,10 @@ func (di *DropIndexes) command(dst []byte, _ description.SelectedServer) ([]byte dst = bsoncore.AppendDocumentElement(dst, "index", t) } } + // Set rawData for 8.2+ servers. + if di.rawData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) { + dst = bsoncore.AppendBooleanElement(dst, "rawData", *di.rawData) + } return dst, nil } @@ -248,3 +253,13 @@ func (di *DropIndexes) Authenticator(authenticator driver.Authenticator) *DropIn di.authenticator = authenticator return di } + +// RawData sets the rawData to access timeseries data in the compressed format. +func (di *DropIndexes) RawData(rawData bool) *DropIndexes { + if di == nil { + di = new(DropIndexes) + } + + di.rawData = &rawData + return di +} diff --git a/x/mongo/driver/operation/list_collections.go b/x/mongo/driver/operation/list_collections.go index 3f9b55a6c3..672404cb0b 100644 --- a/x/mongo/driver/operation/list_collections.go +++ b/x/mongo/driver/operation/list_collections.go @@ -39,6 +39,7 @@ type ListCollections struct { batchSize *int32 serverAPI *driver.ServerAPIOptions timeout *time.Duration + rawData *bool } // NewListCollections constructs and returns a new ListCollections. @@ -92,7 +93,7 @@ func (lc *ListCollections) Execute(ctx context.Context) error { } -func (lc *ListCollections) command(dst []byte, _ description.SelectedServer) ([]byte, error) { +func (lc *ListCollections) command(dst []byte, desc description.SelectedServer) ([]byte, error) { dst = bsoncore.AppendInt32Element(dst, "listCollections", 1) if lc.filter != nil { dst = bsoncore.AppendDocumentElement(dst, "filter", lc.filter) @@ -110,6 +111,11 @@ func (lc *ListCollections) command(dst []byte, _ description.SelectedServer) ([] } dst = bsoncore.AppendDocumentElement(dst, "cursor", cursorDoc.Build()) + // Set rawData for 8.2+ servers. + if lc.rawData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) { + dst = bsoncore.AppendBooleanElement(dst, "rawData", *lc.rawData) + } + return dst, nil } @@ -274,3 +280,13 @@ func (lc *ListCollections) Authenticator(authenticator driver.Authenticator) *Li lc.authenticator = authenticator return lc } + +// RawData sets the rawData to access timeseries data in the compressed format. +func (lc *ListCollections) RawData(rawData bool) *ListCollections { + if lc == nil { + lc = new(ListCollections) + } + + lc.rawData = &rawData + return lc +} diff --git a/x/mongo/driver/operation/list_indexes.go b/x/mongo/driver/operation/list_indexes.go index d7642a19e1..21b138a40c 100644 --- a/x/mongo/driver/operation/list_indexes.go +++ b/x/mongo/driver/operation/list_indexes.go @@ -34,6 +34,7 @@ type ListIndexes struct { crypt driver.Crypt serverAPI *driver.ServerAPIOptions timeout *time.Duration + rawData *bool result driver.CursorResponse } @@ -91,16 +92,19 @@ func (li *ListIndexes) Execute(ctx context.Context) error { } -func (li *ListIndexes) command(dst []byte, _ description.SelectedServer) ([]byte, error) { +func (li *ListIndexes) command(dst []byte, desc description.SelectedServer) ([]byte, error) { dst = bsoncore.AppendStringElement(dst, "listIndexes", li.collection) cursorIdx, cursorDoc := bsoncore.AppendDocumentStart(nil) if li.batchSize != nil { - cursorDoc = bsoncore.AppendInt32Element(cursorDoc, "batchSize", *li.batchSize) } cursorDoc, _ = bsoncore.AppendDocumentEnd(cursorDoc, cursorIdx) dst = bsoncore.AppendDocumentElement(dst, "cursor", cursorDoc) + // Set rawData for 8.2+ servers. + if li.rawData != nil && desc.WireVersion != nil && driverutil.VersionRangeIncludes(*desc.WireVersion, 27) { + dst = bsoncore.AppendBooleanElement(dst, "rawData", *li.rawData) + } return dst, nil } @@ -235,3 +239,13 @@ func (li *ListIndexes) Authenticator(authenticator driver.Authenticator) *ListIn li.authenticator = authenticator return li } + +// RawData sets the rawData to access timeseries data in the compressed format. +func (li *ListIndexes) RawData(rawData bool) *ListIndexes { + if li == nil { + li = new(ListIndexes) + } + + li.rawData = &rawData + return li +} diff --git a/x/mongo/driver/xoptions/options.go b/x/mongo/driver/xoptions/options.go index 52b308a74e..fa11dd60b8 100644 --- a/x/mongo/driver/xoptions/options.go +++ b/x/mongo/driver/xoptions/options.go @@ -86,6 +86,27 @@ func SetInternalBulkWriteOptions(a *options.BulkWriteOptionsBuilder, key string, return nil } +// SetInternalClientBulkWriteOptions sets internal options for ClientBulkWriteOptions. +func SetInternalClientBulkWriteOptions(a *options.ClientBulkWriteOptionsBuilder, key string, option any) error { + typeErrFunc := func(t string) error { + return fmt.Errorf("unexpected type for %q: %T is not %s", key, option, t) + } + switch key { + case "rawData": + b, ok := option.(bool) + if !ok { + return typeErrFunc("bool") + } + a.Opts = append(a.Opts, func(opts *options.ClientBulkWriteOptions) error { + opts.Internal = optionsutil.WithValue(opts.Internal, key, b) + return nil + }) + default: + return fmt.Errorf("unsupported option: %q", key) + } + return nil +} + // SetInternalCountOptions sets internal options for CountOptions. func SetInternalCountOptions(a *options.CountOptionsBuilder, key string, option any) error { typeErrFunc := func(t string) error { @@ -107,6 +128,27 @@ func SetInternalCountOptions(a *options.CountOptionsBuilder, key string, option return nil } +// SetInternalCreateIndexesOptions sets internal options for CreateIndexesOptions. +func SetInternalCreateIndexesOptions(a *options.CreateIndexesOptionsBuilder, key string, option any) error { + typeErrFunc := func(t string) error { + return fmt.Errorf("unexpected type for %q: %T is not %s", key, option, t) + } + switch key { + case "rawData": + b, ok := option.(bool) + if !ok { + return typeErrFunc("bool") + } + a.Opts = append(a.Opts, func(opts *options.CreateIndexesOptions) error { + opts.Internal = optionsutil.WithValue(opts.Internal, key, b) + return nil + }) + default: + return fmt.Errorf("unsupported option: %q", key) + } + return nil +} + // SetInternalDeleteOneOptions sets internal options for DeleteOneOptions. func SetInternalDeleteOneOptions(a *options.DeleteOneOptionsBuilder, key string, option any) error { typeErrFunc := func(t string) error { @@ -170,6 +212,27 @@ func SetInternalDistinctOptions(a *options.DistinctOptionsBuilder, key string, o return nil } +// SetInternalDropIndexesOptions sets internal options for DropIndexesOptions. +func SetInternalDropIndexesOptions(a *options.DropIndexesOptionsBuilder, key string, option any) error { + typeErrFunc := func(t string) error { + return fmt.Errorf("unexpected type for %q: %T is not %s", key, option, t) + } + switch key { + case "rawData": + b, ok := option.(bool) + if !ok { + return typeErrFunc("bool") + } + a.Opts = append(a.Opts, func(opts *options.DropIndexesOptions) error { + opts.Internal = optionsutil.WithValue(opts.Internal, key, b) + return nil + }) + default: + return fmt.Errorf("unsupported option: %q", key) + } + return nil +} + // SetInternalEstimatedDocumentCountOptions sets internal options for EstimatedDocumentCountOptions. func SetInternalEstimatedDocumentCountOptions(a *options.EstimatedDocumentCountOptionsBuilder, key string, option any) error { typeErrFunc := func(t string) error { @@ -338,6 +401,48 @@ func SetInternalInsertOneOptions(a *options.InsertOneOptionsBuilder, key string, return nil } +// SetInternalListCollectionsOptions sets internal options for ListCollectionsOptions. +func SetInternalListCollectionsOptions(a *options.ListCollectionsOptionsBuilder, key string, option any) error { + typeErrFunc := func(t string) error { + return fmt.Errorf("unexpected type for %q: %T is not %s", key, option, t) + } + switch key { + case "rawData": + b, ok := option.(bool) + if !ok { + return typeErrFunc("bool") + } + a.Opts = append(a.Opts, func(opts *options.ListCollectionsOptions) error { + opts.Internal = optionsutil.WithValue(opts.Internal, key, b) + return nil + }) + default: + return fmt.Errorf("unsupported option: %q", key) + } + return nil +} + +// SetInternalListIndexesOptions sets internal options for ListIndexesOptions. +func SetInternalListIndexesOptions(a *options.ListIndexesOptionsBuilder, key string, option any) error { + typeErrFunc := func(t string) error { + return fmt.Errorf("unexpected type for %q: %T is not %s", key, option, t) + } + switch key { + case "rawData": + b, ok := option.(bool) + if !ok { + return typeErrFunc("bool") + } + a.Opts = append(a.Opts, func(opts *options.ListIndexesOptions) error { + opts.Internal = optionsutil.WithValue(opts.Internal, key, b) + return nil + }) + default: + return fmt.Errorf("unsupported option: %q", key) + } + return nil +} + // SetInternalReplaceOptions sets internal options for ReplaceOptions. func SetInternalReplaceOptions(a *options.ReplaceOptionsBuilder, key string, option any) error { typeErrFunc := func(t string) error {