Skip to content

Commit 9358b40

Browse files
author
Divjot Arora
authored
Fix wildcard index test to match the format returned by the server (#399)
1 parent 666ea88 commit 9358b40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mongo/integration/index_view_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ func TestIndexView(t *testing.T) {
116116
})
117117
mt.Run("wildcard projection", func(mt *mtest.T) {
118118
iv := mt.Coll.Indexes()
119-
proj := bson.D{{"a", int32(1)}, {"b.c", int32(1)}}
119+
120+
// Create an index with a wildcard projection document. The "_id: false" isn't needed to create the
121+
// index. We use the listIndexes command below to assert that the created index has this projection
122+
// document and the format of the document returned by listIndexes was changed in 4.5.x to explicitly
123+
// include "_id: false", so we include it here too.
124+
proj := bson.D{{"a", true}, {"_id", false}}
120125
_, err := iv.CreateOne(mtest.Background, mongo.IndexModel{
121126
Keys: keysDoc,
122127
Options: options.Index().SetWildcardProjection(proj),

0 commit comments

Comments
 (0)