Skip to content

Commit

Permalink
Remove Drop option from collectionopt
Browse files Browse the repository at this point in the history
GODRIVER-52

Change-Id: If6b6f70c2e40742ff7fa185f91e254e2d71f1517
  • Loading branch information
rfblue2 committed Jul 24, 2018
1 parent aa6b7a8 commit eecffe0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
5 changes: 3 additions & 2 deletions mongo/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/mongodb/mongo-go-driver/mongo/countopt"
"github.com/mongodb/mongo-go-driver/mongo/deleteopt"
"github.com/mongodb/mongo-go-driver/mongo/distinctopt"
"github.com/mongodb/mongo-go-driver/mongo/dropcollopt"
"github.com/mongodb/mongo-go-driver/mongo/findopt"
"github.com/mongodb/mongo-go-driver/mongo/insertopt"
"github.com/mongodb/mongo-go-driver/mongo/replaceopt"
Expand Down Expand Up @@ -1075,14 +1076,14 @@ func (coll *Collection) Indexes() IndexView {
}

// Drop drops this collection from database.
func (coll *Collection) Drop(ctx context.Context, opts ...collectionopt.Drop) error {
func (coll *Collection) Drop(ctx context.Context, opts ...dropcollopt.DropColl) error {
if ctx == nil {
ctx = context.Background()
}

var sess *session.Client
for _, opt := range opts {
if conv, ok := opt.(collectionopt.DropCollSession); ok {
if conv, ok := opt.(dropcollopt.DropCollSession); ok {
sess = conv.ConvertDropCollSession()
}
}
Expand Down
22 changes: 0 additions & 22 deletions mongo/collectionopt/collectionopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/mongodb/mongo-go-driver/core/readconcern"
"github.com/mongodb/mongo-go-driver/core/readpref"
"github.com/mongodb/mongo-go-driver/core/session"
"github.com/mongodb/mongo-go-driver/core/writeconcern"
)

Expand Down Expand Up @@ -38,27 +37,6 @@ func (*CollectionBundle) collectionOption() {}
// OptionFunc implements Option.
func (optionFunc) collectionOption() {}

// Drop represents all possible params for the drop() function.
type Drop interface {
drop()
}

// DropCollSession is the session for the drop() function.
type DropCollSession interface {
Drop
ConvertDropCollSession() *session.Client
}

// DropSessionOpt is a drop session option.
type DropSessionOpt struct{}

func (DropSessionOpt) drop() {}

// ConvertDropCollSession implements the DropCollSession interface.
func (DropSessionOpt) ConvertDropCollSession() *session.Client {
return nil
}

// BundleCollection bundles collection options.
func BundleCollection(opts ...Option) *CollectionBundle {
head := collectionBundle
Expand Down
3 changes: 0 additions & 3 deletions mongo/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/mongodb/mongo-go-driver/core/session"
"github.com/mongodb/mongo-go-driver/mongo/aggregateopt"
"github.com/mongodb/mongo-go-driver/mongo/changestreamopt"
"github.com/mongodb/mongo-go-driver/mongo/collectionopt"
"github.com/mongodb/mongo-go-driver/mongo/countopt"
"github.com/mongodb/mongo-go-driver/mongo/dbopt"
"github.com/mongodb/mongo-go-driver/mongo/deleteopt"
Expand All @@ -39,7 +38,6 @@ type Session struct {
countopt.CountSessionOpt
deleteopt.DeleteSessionOpt
distinctopt.DistinctSessionOpt
collectionopt.DropSessionOpt
dbopt.DropDBSessionOpt
findopt.FindSessionOpt
dropcollopt.DropCollSessionOpt
Expand All @@ -59,7 +57,6 @@ var (
_ changestreamopt.ChangeStream = (*Session)(nil)
_ deleteopt.Delete = (*Session)(nil)
_ distinctopt.Distinct = (*Session)(nil)
_ collectionopt.Drop = (*Session)(nil)
_ dbopt.DropDB = (*Session)(nil)
_ findopt.Find = (*Session)(nil)
_ findopt.One = (*Session)(nil)
Expand Down

0 comments on commit eecffe0

Please sign in to comment.