开发者

Listing files in GridFS directory using Ruby driver

开发者 https://www.devze.com 2023-03-17 16:35 出处:网络
Is it possible to list all files in given GridFS directory using ruby mongo driver? I\'ve searched through documentatio开发者_高级运维n and have not found anything satisfying. What is more I cannot fi

Is it possible to list all files in given GridFS directory using ruby mongo driver? I've searched through documentatio开发者_高级运维n and have not found anything satisfying. What is more I cannot find any way to search files by metadata too. I have checked java driver's documentation and both of these functionalities are available out of the box using GridFS class.

Best regards,

Michał


grid = Mongo::Grid.new(Mongoid.database)
files = grid.instance_variable_get :@files
files.find("filename" => "uploads/143-normal_regular2.jpg").as_json

# files.remove - deletes alle files

same works for chunks

0

精彩评论

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

关注公众号