Database Reference
In-Depth Information
C.2.2
GridFS with mongofiles
The MongoDB distribution includes a handy utility called mongofiles for listing, put-
ting, getting, and deleting GridFS files using the command line. For example, you can
list the GridFS files in the images database:
$ mongofiles -d images list
connected to: 127.0.0.1
canyon.jpg 2004828
You can also easily add files. Here's how you can add the copy of the image that you
wrote with the Ruby script:
$ mongofiles -d images put canyon-copy.jpg
connected to: 127.0.0.1
added file: { _id: ObjectId('4d61783326758d4e6727228f'),
filename: "canyon-copy.jpg",
chunkSize: 262144, uploadDate: new Date(1298233395296),
md5: "9725ad463b646ccbd287be87cb9b1f6e", length: 2004828 }
You can again list the files to verify that the copy was written:
$ mongofiles -d images list
connected to: 127.0.0.1
canyon.jpg 2004828
canyon-copy.jpg 2004828
mongofiles supports a number of options, and you can view them with the --help
parameter:
$ mongofiles --help
Search WWH ::




Custom Search