Reputation: 138
I am starting to use GridFS within a Meteor app. I have set up the file collection "assetFiles" with a GridFS storage adapter like this :
AssetCollection = new Mongo.Collection( "assets" );
AssetFileStore = new FS.Store.GridFS( "assetFiles" );
AssetFilesCollection = new FS.Collection( "assetFiles", {
stores: [AssetFileStore]
});
AssetFilesCollection.allow({
insert: function(){
return true;
},
update: function(){
return true;
},
remove: function(){
return true;
},
download: function(){
return true;
}
});
I have inserted some files in it and using meteor mongo client checked they actually exist in db.
Now I would like to extract a file from this db to my file system using mongofiles utility.
using the meteor mongodb database, here is the list of collections :
meteor:PRIMARY> show collections
assets
cfs._tempstore.chunks
cfs.assetFiles.filerecord
cfs_gridfs._tempstore.chunks
cfs_gridfs._tempstore.files
cfs_gridfs.assetFiles.chunks
cfs_gridfs.assetFiles.files
meteor_accounts_loginServiceConfiguration
system.indexes
users
And I don't understand how with the mongofiles utility I could target my assetFiles GridFS file collection to get a particular file or even a list of files.
Here is my attempt:
./mongofiles -h 127.0.0.1:3001 -d meteor list
2015-05-11T17:34:40.701+0200 connected to: 127.0.0.1:3001
It just returns nothing while successfully connecting to db. My db is on my own FS. I wanted to specify a collection name, but this parameter does not exists anymore apparently.
Thank you for your help!
Upvotes: 2
Views: 529
Reputation: 421
you need to change the prefix to attach to the right collection.
$ mongofiles --help
....
--prefix= GridFS prefix to use (default is 'fs')`
eg.
mongofiles --port 3001 -d meteor --prefix 'cfs_gridfs.assetFiles' list
hope this helps! accept please thanks!
Upvotes: 3