summaryrefslogtreecommitdiff
path: root/mongofiles/main
diff options
context:
space:
mode:
authorSam Helman <sam.helman@10gen.com>2014-12-01 13:51:06 -0500
committerSam Helman <sam.helman@10gen.com>2014-12-01 17:37:54 -0500
commit7c966ee0717081a58b0e15cfa82dba2a78e3ee0a (patch)
treea78ac112748bc4d3dea316fbd4b5fb758d1f81d9 /mongofiles/main
parent3a45b916939f9382824cbaa500e3a2c4be51feb6 (diff)
downloadmongo-7c966ee0717081a58b0e15cfa82dba2a78e3ee0a.tar.gz
TOOLS-296: conditionally disable 'direct' connection mode with replset-formatted hostnames
Former-commit-id: aaa7c164e8922e205265d0094cb45e82eb19bf49
Diffstat (limited to 'mongofiles/main')
-rw-r--r--mongofiles/main/mongofiles.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/mongofiles/main/mongofiles.go b/mongofiles/main/mongofiles.go
index eb4e901c0ed..ba27b0aaaf3 100644
--- a/mongofiles/main/mongofiles.go
+++ b/mongofiles/main/mongofiles.go
@@ -5,6 +5,7 @@ import (
"github.com/mongodb/mongo-tools/common/db"
"github.com/mongodb/mongo-tools/common/log"
commonopts "github.com/mongodb/mongo-tools/common/options"
+ "github.com/mongodb/mongo-tools/common/util"
"github.com/mongodb/mongo-tools/mongofiles"
"github.com/mongodb/mongo-tools/mongofiles/options"
"os"
@@ -52,6 +53,10 @@ func main() {
// add the specified database to the namespace options struct
opts.Namespace.DB = storageOpts.DB
+ // connect directly, unless a replica set name is explicitly specified
+ _, setName := util.ParseConnectionString(opts.Host)
+ opts.Direct = (setName == "")
+
// create a session provider to connect to the db
mf := mongofiles.MongoFiles{
ToolOptions: opts,