Reputation: 371
I had added files to mongodb with GridFS
some = Pictures.findOne({name:"Screen Shot 2014-10-20 at 17.34.59.png"})
Object {_id: "t5ykoBS2aRhu99Syd", name: "Screen Shot 2014-10-20 at 17.34.59.png", image: FS.File}
but when I've tried to get file
some.getFileRecord() // Object {}
No data. How to get image/file or Url back, from db?
Upvotes: 1
Views: 1580
Reputation: 2002
The some.image
is a FS.File
, which has the method url
. That way you can at least get the url to the image, as seen on https://github.com/CollectionFS/Meteor-CollectionFS#url
Update: I have a minimal, working example of GridFS, that returns an url (and you can thus show the image on a website for example: https://gist.github.com/ayonix/a02ed2512bc9070259d3
Upvotes: 2