Skip to content

Commit ee65456

Browse files
committed
WIP
1 parent 0701937 commit ee65456

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

.evergreen/config.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ functions:
434434
params:
435435
binary: "bash"
436436
env:
437-
SEARCH_INDEX_URI: "${MONGODB_URI}"
437+
SEARCH_INDEX_URI: "${SEARCH_INDEX_URI}"
438438
args: [*task-runner, evg-test-search-index]
439439

440440
add-aws-auth-variables-to-file:
@@ -2067,6 +2067,15 @@ task_groups:
20672067
- command: expansions.update
20682068
params:
20692069
file: src/go.mongodb.org/mongo-driver/atlas-expansion.yml
2070+
- command: shell.exec
2071+
params:
2072+
working_dir: src/go.mongodb.org/mongo-driver
2073+
shell: bash
2074+
script: |-
2075+
echo "SEARCH_INDEX_URI: ${MONGODB_URI}" > atlas-expansion.yml
2076+
- command: expansions.update
2077+
params:
2078+
file: src/go.mongodb.org/mongo-driver/atlas-expansion.yml
20702079
teardown_group:
20712080
- command: subprocess.exec
20722081
params:

internal/integration/search_index_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,19 @@ func TestSearchIndex(t *testing.T) {
3535
mt.Run("search indexes with empty option", func(mt *mtest.T) {
3636
ctx := context.Background()
3737

38-
_, err := mt.Coll.InsertMany(ctx, []interface{}{
38+
_, err := mt.Coll.InsertMany(ctx, []any{
3939
bson.M{
4040
"string_field": "test1 test1",
4141
},
4242
})
4343
require.NoError(mt, err, "failed to insert")
4444

45-
view := mt.Coll.SearchIndexes()
46-
47-
definition := bson.D{
48-
{"mappings", bson.D{
49-
{"dynamic", true},
50-
}},
51-
}
52-
_, err = view.CreateOne(ctx, mongo.SearchIndexModel{
53-
Definition: definition,
45+
_, err = mt.Coll.SearchIndexes().CreateOne(ctx, mongo.SearchIndexModel{
46+
Definition: bson.D{
47+
{"mappings", bson.D{
48+
{"dynamic", true},
49+
}},
50+
},
5451
})
5552
require.NoError(mt, err, "failed to create index")
5653
})

mongo/search_index_view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ func (siv SearchIndexView) CreateMany(
123123
}
124124

125125
var iidx int32
126+
iidx, indexes = bsoncore.AppendDocumentElementStart(indexes, strconv.Itoa(i))
126127
if model.Options != nil {
127128
searchIndexArgs, err := mongoutil.NewOptions[options.SearchIndexesOptions](model.Options)
128129
if err != nil {
129130
return nil, fmt.Errorf("failed to construct options from builder: %w", err)
130131
}
131132

132-
iidx, indexes = bsoncore.AppendDocumentElementStart(indexes, strconv.Itoa(i))
133133
if searchIndexArgs.Name != nil {
134134
indexes = bsoncore.AppendStringElement(indexes, "name", *searchIndexArgs.Name)
135135
}

0 commit comments

Comments
 (0)