-
Notifications
You must be signed in to change notification settings - Fork 3
Useful MongoDB commands
roscisz edited this page Jul 26, 2017
·
1 revision
In all of the below commands it is assumed that database is at localhost. To connect to database at other server add to the parameters: --host :. You may also specify other filename for the file on local filesystem than filename used in mongo by specifying --local <local_filename>.
To list available files for use as input run:
mongofiles --db hive-dataserver -u hive-dataserver -p hive-dataserver --authenticationDatabase admin list
To add file run:
mongofiles --db hive-dataserver -u hive-dataserver -p hive-dataserver --authenticationDatabase admin put
To retrieve file from database run:
mongofiles --db hive-dataserver -u hive-dataserver -p hive-dataserver --authenticationDatabase admin get
To delete file from database run:
mongofiles --db hive-dataserver -u hive-dataserver -p hive-dataserver --authenticationDatabase admin delete
It is especially useful for removing output files as each consecutive run creates output file with the same name.