brandonhilkert/mongo-restore-s3 — Issue #1: Allow overwriting of existing extracted DB
Author: chris-lee
Created: 2011-11-30 18:48:37+00:00
State: open

When an existing DB is already found, the script displays an error, but it would be great if there's an additional flag that could be displayed which would allow me to overwrite the existing extracted DB.

Found existing extracted DB

Note: If you wanted to restore from a new download,
delete the /tmp/meeteor_production
folder containing the extracted DB.

Restoring backup...
/path/mongo-restore-s3/mongo-restore-s3.rb:81: warning: Insecure world writable dir /private/tmp/. in PATH, mode 041777
ERROR: too many positional options

usage: mongorestore [options] [directory or filename to restore from]
options:
--help produce help message
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
-h [ --host ] arg mongo host to connect to ( /s1,s2 for sets)
--port arg server port. Can also use --host hostname:port
--ipv6 enable IPv6 support (disabled by default)
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod database files in the given
path, instead of connecting to a mongod server -
needs to lock the data directory, so cannot be used
if a mongod is currently accessing the same path
--directoryperdb if dbpath specified, each db is in a separate
directory
-d [ --db ] arg database to use
-c [ --collection ] arg collection to use (some commands)
--objcheck validate object before inserting
--filter arg filter to apply before inserting
--drop drop each collection before import
--oplogReplay replay oplog for point-in-time restore
Done!
%

Also, if it's going to abort and display an error, it should probably abort the entire script right away vs. continuing to try the restore which then displays other errors.