-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:macos go1.13
// code placeholder // Main package for the mongodump tool.// Main package for the mongodump tool.package main import ( "log" "os" "github.com/mongodb/mongo-tools-common/options" "github.com/mongodb/mongo-tools-common/util" "github.com/mongodb/mongo-tools/mongodump") func DemoDump() { host := "ip:27017" username, password, database := "xxx", "xxx", "test" rui, err := options.NewURI(host) toolOpts := &options.ToolOptions{ URI: rui, Auth: &options.Auth{ Username: username, Password: password, Source: database, Mechanism: "SCRAM-SHA-1", }, } inputOpts := &mongodump.InputOptions{} outputOpts := &mongodump.OutputOptions{} // connect directly, unless a replica set name is explicitly specified //_, setName := util.ParseConnectionString(host) //toolOpts.Direct = (setName == "") //toolOpts.ReplicaSetName = setName dump := mongodump.MongoDump{ ToolOptions: toolOpts, OutputOptions: outputOpts, InputOptions: inputOpts, } if err = dump.Init(); err != nil { log.Printf("Failed: %v", err) os.Exit(util.ExitError) } if err = dump.Dump(); err != nil { log.Printf("Failed: %v", err) if err == util.ErrTerminated { os.Exit(util.ExitKill) } os.Exit(util.ExitError) } }
when go build, it failed and output
macbookpro:go_dirver fredlee$ go build
- github.com/mongodb/mongo-tools-common/db
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/buffered_bulk.go:83:101: cannot use "github.com/mongodb/mongo-go-driver/mongo/options".InsertMany().SetOrdered(!bb.unordered) (type *"github.com/mongodb/mongo-go-driver/mongo/options".InsertManyOptions) as type *"go.mongodb.org/mongo-driver/mongo/options".InsertManyOptions in argument to bb.collection.InsertMany
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/command.go:126:34: cannot use "github.com/mongodb/mongo-go-driver/mongo/options".RunCmd().SetReadPreference("github.com/mongodb/mongo-go-driver/mongo/readpref".Nearest()) (type *"github.com/mongodb/mongo-go-driver/mongo/options".RunCmdOptions) as type *"go.mongodb.org/mongo-driver/mongo/options".RunCmdOptions in argument to session.Database("admin").RunCommand
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/command.go:126:51: cannot use "github.com/mongodb/mongo-go-driver/mongo/readpref".Nearest() (type *"github.com/mongodb/mongo-go-driver/mongo/readpref".ReadPref) as type *"go.mongodb.org/mongo-driver/mongo/readpref".ReadPref in argument to "github.com/mongodb/mongo-go-driver/mongo/options".RunCmd().SetReadPreference
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/command.go:255:60: cannot use opts (type *"github.com/mongodb/mongo-go-driver/mongo/options".FindOneOptions) as type *"go.mongodb.org/mongo-driver/mongo/options".FindOneOptions in argument to session.Database(db).Collection(collection).FindOne
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/db.go:177:11: clientopt.SetSingle undefined (type *"github.com/mongodb/mongo-go-driver/mongo/options".ClientOptions has no field or method SetSingle)
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/db.go:179:35: cannot use opts.ReadPreference (type *"github.com/mongodb/mongo-go-driver/mongo/readpref".ReadPref) as type *"go.mongodb.org/mongo-driver/mongo/readpref".ReadPref in argument to clientopt.SetReadPreference
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/db.go:209:11: undefined: "github.com/mongodb/mongo-go-driver/mongo/options".SSLOpt
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/db.go:222:12: clientopt.SetSSL undefined (type *"github.com/mongodb/mongo-go-driver/mongo/options".ClientOptions has no field or method SetSSL)
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/db.go:234:9: undefined: mongo.NewClientWithOptions
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/namespaces.go:97:2: cannot use *mongo.Cursor value as type mongo.Cursor in return argument
../../../../../pkg/mod/github.com/mongodb/mongo-tools-common@v0.0.0/db/namespaces.go:97:2: too many errors
macbookpro:go_dirver fredlee$
how to fix this issue
- related to
-
GODRIVER-1312 how to support export mongodb dump or export function in mongo-go-driver
- Closed