Skip to content

Commit

Permalink
GODRIVER-2701 PR Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-kim-mongo committed Jul 3, 2024
1 parent d1c21b1 commit b9defa0
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions mongo/integration/index_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/google/go-cmp/cmp"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/internal/assert"
"go.mongodb.org/mongo-driver/internal/require"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/integration/mtest"
"go.mongodb.org/mongo-driver/mongo/options"
Expand Down Expand Up @@ -651,30 +650,18 @@ func TestIndexView(t *testing.T) {
},
index: bson.D{{"foo", 1}, {"bar", 1}},
},
/*{
name: "clustered indexes",
models: []mongo.IndexModel{
{
Keys: bson.Raw(bsoncore.NewDocumentBuilder().AppendInt32("foo", 1).Build()),
},
{
Keys: map[string]interface{}{"key": bson.D{{"_id", 1}}},
},
},
index: map[string]interface{}{"key": bson.D{{"_id", 1}}},
},*/
{
name: "text index",
models: []mongo.IndexModel{
{
Keys: bson.D{{"_id", 1}},
},
{
Keys: bson.D{{"plot", "text"}},
Keys: bson.D{{"plot1", "text"}, {"plot2", "text"}},
},
},
// Key is automatically set to Full Text Search for any text index
index: map[string]interface{}{"_fts": "text", "_ftsx": 1},
//index: map[string]interface{}{"plot": "text"},
},
}

Expand All @@ -684,23 +671,12 @@ func TestIndexView(t *testing.T) {
indexNames, err := iv.CreateMany(context.Background(), test.models)

assert.NoError(mt, err)
assert.Equal(mt, 2, len(indexNames), "expected 2 index names, got %v", len(indexNames))

// List existing indexes
cursor, err := mt.Coll.Indexes().List(context.Background())
require.NoError(t, err)

var indexes []bson.M
err = cursor.All(context.Background(), &indexes)
require.NoError(t, err)

t.Logf("Existing indexes: %v", indexes)
//////
assert.Equal(mt, len(test.models), len(indexNames), "expected %v index names, got %v", len(test.models), len(indexNames))

_, err = iv.DropWithKey(context.Background(), test.index)
assert.Nil(mt, err, "DropOne error: %v", err)

cursor, err = iv.List(context.Background())
cursor, err := iv.List(context.Background())
assert.Nil(mt, err, "List error: %v", err)
for cursor.Next(context.Background()) {
var idx index
Expand Down

0 comments on commit b9defa0

Please sign in to comment.