Skip to content

Commit 570ae17

Browse files
GODRIVER-3277 Rename DropWithKey to DropOneWithKey (#1709)
1 parent 9a02911 commit 570ae17

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mongo/index_view.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,12 @@ func (iv IndexView) DropOne(ctx context.Context, name string, opts ...*options.D
435435
return iv.drop(ctx, name, opts...)
436436
}
437437

438-
// DropWithKey drops a collection index by key using the dropIndexes operation. If the operation succeeds, this returns
438+
// DropOneWithKey drops a collection index by key using the dropIndexes operation. If the operation succeeds, this returns
439439
// a BSON document in the form {nIndexesWas: <int32>}. The "nIndexesWas" field in the response contains the number of
440440
// indexes that existed prior to the drop.
441441
//
442442
// This function is useful to drop an index using its key specification instead of its name.
443-
func (iv IndexView) DropWithKey(ctx context.Context, keySpecDocument interface{}, opts ...*options.DropIndexesOptions) (bson.Raw, error) {
443+
func (iv IndexView) DropOneWithKey(ctx context.Context, keySpecDocument interface{}, opts ...*options.DropIndexesOptions) (bson.Raw, error) {
444444
doc, err := marshal(keySpecDocument, iv.coll.bsonOpts, iv.coll.registry)
445445
if err != nil {
446446
return nil, err

mongo/integration/index_view_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ func TestIndexView(t *testing.T) {
674674
assert.NoError(mt, err)
675675
assert.Equal(mt, len(test.models), len(indexNames), "expected %v index names, got %v", len(test.models), len(indexNames))
676676

677-
_, err = iv.DropWithKey(context.Background(), test.index)
677+
_, err = iv.DropOneWithKey(context.Background(), test.index)
678678
assert.Nil(mt, err, "DropOne error: %v", err)
679679

680680
cursor, err := iv.List(context.Background())

0 commit comments

Comments
 (0)