Best practice for Files collections?

Hi folks,

As part of a larger app I’m building out a media library using Meteor-Files and I’m wondering a few things:

  1. Should I add metadata (tags / project assignment / potentially user sharing) to the FilesCollection? Or should I keep a second collection for metadata that points to the file in the FilesCollection?

  2. How can I best implement a user workflow where they start uploading a file, while adding metadata and save when it’s all done?

  3. What are the advantages / disadvantages of file system vs GridFS?

  4. Any gotcha’s I should look out for?

1 Like

A few things I’ve learned (in the context of images):

  1. Really think about the metadata you will need. It’s much easier to remove data than it is to retroactively generate it. For example, I wish I would’ve written the aspect ratio to the metadata, instead of having to calculate it on the fly all the time. We have a metadata collection that we use for storing metadata about other documents, and I’ll say that it’s more convenient to store the metadata on the actual document if possible, especially if you work with permissions.

  2. Not really sure how MF works, but our flow is basically – insert a placeholder into the collection with some metadata, init the upload, get the path as a callback and write that to the placeholder, along with some additional metadata generated by the upload.

  3. Not sure, we use lepozepo:S3

  4. Like I said in #1, just try to plan ahead. Think about the possible use cases, and all the potential helpers you might have to write =)

1 Like


It’s a good point about metadata, and one I hadn’t thought a lot about. The larger app has a very general content management system component which could be used a lot of different ways, so loading up all the metadata up front will help a lot.