Upload file without collections

Hello,

I would like to send a xml to import data in my MongoDB database.

I’ve seen ostrio:files but a Collection is needed for it.
Here the purpose is just retrieve xml data on server side, then fill my MongoDB database. I don’t need to store xml and I find ostrio:file too much ‘heavy war machine’ for my simple needs.

I’m using kadira:flow-router and Blaze.
Could you let me know can I achieve this ?
I’d like to track upload progression to go futher, I assume I can use publication/subscription with a ReactiveVar to achieve it.

I’ve seen http://docs.meteor.com/packages/webapp.html, I will try to do with. I would like to know if it is the best option in my case.

You could look at an example repo I put together a while ago (updated yesterday). It polls an XML REST endpoint, decodes the XML and writes to MongoDB:

1 Like

Thank you for your reply.
I’ve seen you are polling using HTTP.get in ukgrid/server/ukgrid.js
Actualy, I’m more looking for a way to upload file using a form.
Assuming FlowRouter is clientside routing, I’m a bit confuse.

So, if I understand you correctly:

  1. User selects a file from the client filesystem.
  2. The content of the file is transferred to the server as an object (but is not stored on the server).
  3. The server processes the content of the object and writes the decoded date to MongoDB.

A file can be transferred as POST data, and as long as it’s not too big, can be managed entirely in memory on the server. You would need a server-side REST endpoint, which flowrouter cannot provide. Check out simple:rest, nimble:restivus, centiq:crud.

1 Like