diff options
author | mike o'brien <mpobrien005@gmail.com> | 2014-09-26 16:00:52 -0400 |
---|---|---|
committer | mike o'brien <mpobrien005@gmail.com> | 2014-09-26 16:00:52 -0400 |
commit | 1d370672f544e83efd1f0556dcae7d026d6c5ae8 (patch) | |
tree | 32a115c820d6c68cf723acdaf0dbc78510a5827e /src | |
parent | 37f304a25127d22f0514801f6170d447d83e6846 (diff) | |
download | mongo-1d370672f544e83efd1f0556dcae7d026d6c5ae8.tar.gz |
fix dumprestore4.js: return a failure code if --collection specified without --db
Former-commit-id: 5a21240a925ca7d12b3cd5976e97fc283362b9ac
Diffstat (limited to 'src')
-rw-r--r-- | src/github.com/mongodb/mongo-tools/mongorestore/mongorestore.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore.go b/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore.go index c1177e08dd9..617eac69f68 100644 --- a/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore.go +++ b/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore.go @@ -54,6 +54,10 @@ func (restore *MongoRestore) ParseAndValidateOptions() error { log.Log(3, "\tdumping with object check enabled") } + if restore.ToolOptions.DB == "" && restore.ToolOptions.Collection != "" { + return fmt.Errorf("cannot dump a collection without a specified database") + } + if restore.OutputOptions.WriteConcern > 0 { restore.safety = &mgo.Safe{W: restore.OutputOptions.WriteConcern} //TODO, audit extra steps log.Logf(3, "\tdumping with w=%v", restore.safety.W) |