> show databases; admin 0.000GB config 0.000GB gridFS 0.000GB local 0.000GB
./mongofiles --help Usage: mongofiles <options> <command> <filename or _id> Manipulate gridfs files using the command line. Possible commands include: list - list all files; 'filename' is an optional prefix which listed filenames must begin with search - search all files; 'filename' is a substring which listed filenames must contain put - add a file with filename 'filename' put_id - add a file with filename 'filename' and a given '_id' get - get a file with filename 'filename' get_id - get a file with the given '_id' delete - delete all files with filename 'filename' delete_id - delete a file with the given '_id'
# ./mongofiles put hello.txt 2020-02-07T14:59:31.536+0800 connected to: localhost added file: hello.txt
./mongofiles -d mytest -l abc.txt put "nabc.txt"
2020-02-07T15:27:52.904+0800 connected to: localhost
added file: nabc.txt
# ./mongofiles list 2020-02-07T14:59:59.712+0800 connected to: localhost hello.txt 22
./mongofiles search x 2020-02-07T15:00:15.743+0800 connected to: localhost hello.txt 22
# ./mongofiles get hello.txt 2020-02-07T15:02:05.850+0800 connected to: localhost finished writing to hello.txt
# ./mongofiles get "nabc.txt" -d mytest -l "mabc.txt" 2020-02-07T15:41:51.203+0800 connected to: localhost finished writing to mabc.txt
# ./mongofiles delete hello.txt 2020-02-07T15:43:21.649+0800 connected to: localhost successfully deleted all instances of 'hello.txt' from GridFS
# ./mongofiles -d mytest delete nabc.txt 2020-02-07T15:43:54.031+0800 connected to: localhost successfully deleted all instances of 'nabc.txt' from GridFS