开发者

GridFS + CarrierWave + nginx unable to get file

开发者 https://www.devze.com 2023-03-13 23:12 出处:网络
In my project I upload audiofiles to GridFS using CarrierWave gem. After uploading file is saved to GridFS properly but in my application I am unable to get it from GridFS with MongoFiles Tool or with

In my project I upload audiofiles to GridFS using CarrierWave gem. After uploading file is saved to GridFS properly but in my application I am unable to get it from GridFS with MongoFiles Tool or with GridFS-nginx module.

mongofiles get audiotracks/4dfb70d6bcd73f3488000002/data

command leads to this error:

assertion: 13325 couldn't open file: audiotracks开发者_JAVA技巧/4dfb70d6bcd73f3488000002/data

The only way to get file is to use rails console and it works fine:

cc = Mongo::GridFileSystem.new(Mongo::Connection.new.db("test")).open('audiotracks/4dfb70d6bcd73f3488000002/data', 'r')

cc.read

So if you have encountered problem like this or have some ideas - plz let me know.


mongofiles get will try to write the file to disk with the same name and path as in GridFS.

Assertion 13325 happens when GridFS can't write the file like this.

You should check if the file path exists and you have the permission to write the file. Alternatively you could just provide a file name with the --local parameter.

mongofiles --local mytrack.mp3 get audiotracks/4dfb70d6bcd73f3488000002/data
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号