Skip to content

GODRIVER-3277 Rename DropWithKey to DropOneWithKey #1709

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

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mongo/index_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ func (iv IndexView) DropOne(ctx context.Context, name string, opts ...*options.D
return iv.drop(ctx, name, opts...)
}

// DropWithKey drops a collection index by key using the dropIndexes operation. If the operation succeeds, this returns
// DropOneWithKey drops a collection index by key using the dropIndexes operation. If the operation succeeds, this returns
// a BSON document in the form {nIndexesWas: <int32>}. The "nIndexesWas" field in the response contains the number of
// indexes that existed prior to the drop.
//
// This function is useful to drop an index using its key specification instead of its name.
func (iv IndexView) DropWithKey(ctx context.Context, keySpecDocument interface{}, opts ...*options.DropIndexesOptions) (bson.Raw, error) {
func (iv IndexView) DropOneWithKey(ctx context.Context, keySpecDocument interface{}, opts ...*options.DropIndexesOptions) (bson.Raw, error) {
doc, err := marshal(keySpecDocument, iv.coll.bsonOpts, iv.coll.registry)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion mongo/integration/index_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ func TestIndexView(t *testing.T) {
assert.NoError(mt, err)
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)
_, err = iv.DropOneWithKey(context.Background(), test.index)
assert.Nil(mt, err, "DropOne error: %v", err)

cursor, err := iv.List(context.Background())
Expand Down
Loading