@@ -13,7 +13,6 @@ import (
1313 "time"
1414
1515 "go.mongodb.org/mongo-driver/v2/bson"
16- "go.mongodb.org/mongo-driver/v2/internal/assert"
1716 "go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
1817 "go.mongodb.org/mongo-driver/v2/internal/require"
1918 "go.mongodb.org/mongo-driver/v2/mongo"
@@ -37,8 +36,14 @@ func TestSearchIndex(t *testing.T) {
3736 mt .Run ("search indexes with empty option" , func (mt * mtest.T ) {
3837 ctx := context .Background ()
3938
40- expected := bson .Raw (bsoncore .NewDocumentBuilder ().
41- AppendString ("mode" , "secondaryPreferred" ).
39+ expected := bson .RawArray (bsoncore .NewArrayBuilder ().AppendDocument (
40+ bsoncore .NewDocumentBuilder ().
41+ AppendDocument ("definition" , bsoncore .NewDocumentBuilder ().
42+ AppendDocument ("mappings" , bsoncore .NewDocumentBuilder ().
43+ AppendBoolean ("dynamic" , true ).
44+ Build ()).
45+ Build ()).
46+ Build ()).
4247 Build ())
4348
4449 _ , err := mt .Coll .SearchIndexes ().CreateOne (ctx , mongo.SearchIndexModel {
@@ -50,8 +55,8 @@ func TestSearchIndex(t *testing.T) {
5055 })
5156 require .NoError (mt , err , "failed to create index" )
5257 evt := mt .GetStartedEvent ()
53- actual , ok := evt .Command .Lookup ("indexes" ).DocumentOK ()
54- assert .True (mt , ok , "expected command %v to contain an indexes document " , evt .Command )
55- assert .Equal (mt , expected , actual , "expected indexes document %v, got %v" , expected , actual )
58+ actual , ok := evt .Command .Lookup ("indexes" ).ArrayOK ()
59+ require .True (mt , ok , "expected command %v to contain an indexes array " , evt .Command )
60+ require .Equal (mt , expected , actual , "expected indexes array %v, got %v" , expected , actual )
5661 })
5762}
0 commit comments