webminal.org
webminal.org

Reputation: 47276

mongofiles : whats the usage of --collection option?

I can use "-d" option to put files into a database.

mongofiles  -d test put file.txt

It worked as expected.I also found out there was collection option. Whats this option for and How to use it? I can't get more info from man page or its help.

EDIT : From here http://www.mongodb.org/display/DOCS/GridFS+Specification . I believe there will be two collection will be created named "files" and "chunk" which will contain metadata of file and its actually data. When I simply use -d option alone. I can see these collections under "test" db. So now ,when i use the option -c does that collection will stores what?

Upvotes: 1

Views: 1884

Answers (3)

crifan
crifan

Reputation: 14328

refer Using mongofiles with GridFS in a meteor app - Stack Overflow, the collection option actually is prefix -> mongofiles --help show this:

--prefix=<prefix>     GridFS prefix to use (default is 'fs') (default: fs)

my example:

mongofiles -d storybook --prefix audio -t audio/mpeg -l=5bd7bd3abfaa44fe2c73754d.mp3 put 5bd7bd3abfaa44fe2c73754d.mp3

Upvotes: 3

enagra
enagra

Reputation: 2325

It seems to be in new releases of mongo only use the fs collection to store files. I could not find the technical reason.

Instead of separating files into collections, Mike O'Brien suggests using prefixes. For example:

mongofiles put /tmp/testfile --prefix "customer1"

Upvotes: 0

Zaur Nasibov
Zaur Nasibov

Reputation: 22659

According to http://api.mongodb.org/python/current/api/gridfs/index.html#gridfs.GridFS collection specifies the root collection to use.

I believe that the expected behaviour is totally internal, i.e. the default collection where the files are stored is 'fs'. You can replace that to have a custom collection name.

Upvotes: 2

Related Questions