-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GODRIVER-2701 Implement a variant of DropIndex that gets keys rather than name #1683
GODRIVER-2701 Implement a variant of DropIndex that gets keys rather than name #1683
Conversation
Note: 56850c7 and before have an implementation of DropOne method taking in a generic of either the key or name which could be considered for 2.0. |
API Change Report./mongocompatible changesIndexView.DropWithKey: added ./x/mongo/driver/operationincompatible changes(*DropIndexes).Index: changed from func(string) *DropIndexes to func(any) *DropIndexes |
e9bb168
to
5cefa42
Compare
66a0dea
to
d1c21b1
Compare
b354e40
to
b9defa0
Compare
1b80825
to
95f571f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
To fix the failings tests, suggest verifying that the indexes were created before dropping by key. You can accomplish this using the verifyIndexExists
helper function:
for _, name := range indexNames {
verifyIndexExists(mt, iv, index{
Key: test.index,
Name: name,
})
}
You will also need to type the +/- 1 index values as int32, e.g. 1
-> int32(1)
. See here for the suggested changes.
2e151cc
to
90a7719
Compare
It seems like the failed tests for the other tests in older version of RHEL are continuing to happen. I will try to investigate this. |
400d7f8
to
23ab5c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
GODRIVER-2701
Summary
The changes in this pull-request answers the ticket GODRIVER-2701 of implements a variant of DropIndex that searches for the index using the key rather than the name of the index. This creates an additional method that allows users to drop index with the freedom of either a name or key.
Background & Motivation
The motivation behind this is to be consistent with the functionality of the MongoDB db.collection.dropIndex() function which allows dropping the index with either a key or name. This is an optional part of the spec - https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.md#standard-api.