React + Meteor filestorage

82 Views Asked by At

I am struggling to understand the best data structures with mongo in regards to images/videos/media. Can someone please clarify?

Typically I would store my data in a collection object, for example a blogpost which would have

{
title: 'foo',
author: 'john',
created_at: Friday Oct 4,
cover_photo: ???????? (base-64?)
...
}

My inclination is to add a "cover_photo" in with this collection. Is this is right approach? I'm sure I could figure out how to base64 encode a huge string and save it here, but my hunch is that is probably not the best way to go about this.

Should I create a second collection Images and map ID's somehow? What is the best approach with mongoDB + Meteor?

I am a front-ender trying to get my feet off the ground with Mongo + FS, any help is much appreciated!

I really like Dropzone, but I'm not sure how they can work together. Should I call the insert Meteor-method just as I would for another Meteor.call? Or is there more to it on the server-side and this is a special case?

I am able to see the blob, however once refreshed, it is no longer there.

0

There are 0 best solutions below