From 0a4389cf1a0a3830b934cb5f26e0d7e408d1816a Mon Sep 17 00:00:00 2001 From: Qingyang Hu Date: Tue, 5 Sep 2023 13:14:54 -0400 Subject: [PATCH] update unified test suite. --- .../unified/collection_operation_execution.go | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/mongo/integration/unified/collection_operation_execution.go b/mongo/integration/unified/collection_operation_execution.go index e91658ca55..83fc736b3a 100644 --- a/mongo/integration/unified/collection_operation_execution.go +++ b/mongo/integration/unified/collection_operation_execution.go @@ -322,10 +322,17 @@ func executeCreateSearchIndex(ctx context.Context, operation *operation) (*opera switch key { case "model": - err = bson.Unmarshal(val.Document(), &model) + var m struct { + Definition interface{} + Name *string + } + err = bson.Unmarshal(val.Document(), &m) if err != nil { return nil, err } + model.Definition = m.Definition + model.Options = options.SearchIndexes() + model.Options.Name = m.Name default: return nil, fmt.Errorf("unrecognized createSearchIndex option %q", key) } @@ -358,11 +365,19 @@ func executeCreateSearchIndexes(ctx context.Context, operation *operation) (*ope return nil, err } for _, val := range vals { - var model mongo.SearchIndexModel - err = bson.Unmarshal(val.Value, &model) + var m struct { + Definition interface{} + Name *string + } + err = bson.Unmarshal(val.Value, &m) if err != nil { return nil, err } + model := mongo.SearchIndexModel{ + Definition: m.Definition, + Options: options.SearchIndexes(), + } + model.Options.Name = m.Name models = append(models, model) } default: