Skip to content

Commit eecffe0

Browse files
committed
Remove Drop option from collectionopt
GODRIVER-52 Change-Id: If6b6f70c2e40742ff7fa185f91e254e2d71f1517
1 parent aa6b7a8 commit eecffe0

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

mongo/collection.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/mongodb/mongo-go-driver/mongo/countopt"
2727
"github.com/mongodb/mongo-go-driver/mongo/deleteopt"
2828
"github.com/mongodb/mongo-go-driver/mongo/distinctopt"
29+
"github.com/mongodb/mongo-go-driver/mongo/dropcollopt"
2930
"github.com/mongodb/mongo-go-driver/mongo/findopt"
3031
"github.com/mongodb/mongo-go-driver/mongo/insertopt"
3132
"github.com/mongodb/mongo-go-driver/mongo/replaceopt"
@@ -1075,14 +1076,14 @@ func (coll *Collection) Indexes() IndexView {
10751076
}
10761077

10771078
// Drop drops this collection from database.
1078-
func (coll *Collection) Drop(ctx context.Context, opts ...collectionopt.Drop) error {
1079+
func (coll *Collection) Drop(ctx context.Context, opts ...dropcollopt.DropColl) error {
10791080
if ctx == nil {
10801081
ctx = context.Background()
10811082
}
10821083

10831084
var sess *session.Client
10841085
for _, opt := range opts {
1085-
if conv, ok := opt.(collectionopt.DropCollSession); ok {
1086+
if conv, ok := opt.(dropcollopt.DropCollSession); ok {
10861087
sess = conv.ConvertDropCollSession()
10871088
}
10881089
}

mongo/collectionopt/collectionopt.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/mongodb/mongo-go-driver/core/readconcern"
77
"github.com/mongodb/mongo-go-driver/core/readpref"
8-
"github.com/mongodb/mongo-go-driver/core/session"
98
"github.com/mongodb/mongo-go-driver/core/writeconcern"
109
)
1110

@@ -38,27 +37,6 @@ func (*CollectionBundle) collectionOption() {}
3837
// OptionFunc implements Option.
3938
func (optionFunc) collectionOption() {}
4039

41-
// Drop represents all possible params for the drop() function.
42-
type Drop interface {
43-
drop()
44-
}
45-
46-
// DropCollSession is the session for the drop() function.
47-
type DropCollSession interface {
48-
Drop
49-
ConvertDropCollSession() *session.Client
50-
}
51-
52-
// DropSessionOpt is a drop session option.
53-
type DropSessionOpt struct{}
54-
55-
func (DropSessionOpt) drop() {}
56-
57-
// ConvertDropCollSession implements the DropCollSession interface.
58-
func (DropSessionOpt) ConvertDropCollSession() *session.Client {
59-
return nil
60-
}
61-
6240
// BundleCollection bundles collection options.
6341
func BundleCollection(opts ...Option) *CollectionBundle {
6442
head := collectionBundle

mongo/session.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/mongodb/mongo-go-driver/core/session"
1313
"github.com/mongodb/mongo-go-driver/mongo/aggregateopt"
1414
"github.com/mongodb/mongo-go-driver/mongo/changestreamopt"
15-
"github.com/mongodb/mongo-go-driver/mongo/collectionopt"
1615
"github.com/mongodb/mongo-go-driver/mongo/countopt"
1716
"github.com/mongodb/mongo-go-driver/mongo/dbopt"
1817
"github.com/mongodb/mongo-go-driver/mongo/deleteopt"
@@ -39,7 +38,6 @@ type Session struct {
3938
countopt.CountSessionOpt
4039
deleteopt.DeleteSessionOpt
4140
distinctopt.DistinctSessionOpt
42-
collectionopt.DropSessionOpt
4341
dbopt.DropDBSessionOpt
4442
findopt.FindSessionOpt
4543
dropcollopt.DropCollSessionOpt
@@ -59,7 +57,6 @@ var (
5957
_ changestreamopt.ChangeStream = (*Session)(nil)
6058
_ deleteopt.Delete = (*Session)(nil)
6159
_ distinctopt.Distinct = (*Session)(nil)
62-
_ collectionopt.Drop = (*Session)(nil)
6360
_ dbopt.DropDB = (*Session)(nil)
6461
_ findopt.Find = (*Session)(nil)
6562
_ findopt.One = (*Session)(nil)

0 commit comments

Comments
 (0)