diff options
author | Spencer T Brody <spencer@10gen.com> | 2011-08-29 15:59:39 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2011-08-29 16:14:48 -0400 |
commit | b9615570452231a87ba14a27cdc36a1708cc6f4c (patch) | |
tree | 2e20a5e93ef3e0adf911aa64432d36f3cba8dd3b /tools | |
parent | 8c0e882052259000c665b7ad28f27118bba0ad6f (diff) | |
download | mongo-b9615570452231a87ba14a27cdc36a1708cc6f4c.tar.gz |
Make mongorestore ignore 'v' option when restoring indexes: SERVER-3687
Diffstat (limited to 'tools')
-rw-r--r-- | tools/restore.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/restore.cpp b/tools/restore.cpp index 9adf90bd209..c08c14fa87b 100644 --- a/tools/restore.cpp +++ b/tools/restore.cpp @@ -39,6 +39,7 @@ class Restore : public BSONTool { public: bool _drop; + bool _keepIndexVersion; string _curns; string _curdb; set<string> _users; // For restoring users with --drop @@ -47,6 +48,7 @@ public: add_options() ("drop" , "drop each collection before import" ) ("oplogReplay" , "replay oplog for point-in-time restore") + ("keepIndexVersion" , "don't upgrade indexes to newest version") ; add_hidden_options() ("dir", po::value<string>()->default_value("dump"), "directory to restore from") @@ -69,6 +71,7 @@ public: } _drop = hasParam( "drop" ); + _keepIndexVersion = hasParam("keepIndexVersion"); bool doOplog = hasParam( "oplogReplay" ); if (doOplog) { @@ -265,7 +268,7 @@ public: string s = _curdb + "." + n.coll; bo.append("ns", s); } - else { + else if (strcmp(e.fieldName(), "v") != 0 || _keepIndexVersion) { // Remove index version number bo.append(e); } } |