Reputation: 3
I am building a web application using Node.js, Backbone.js, and Mongo. This application will allow the user to upload a DXF file to the server so that the file can be "parsed" to extract geometrical information about a building structure. I am trying to decide how to store this dxf file on the server.
Is there any benefit to storing the file as a large string in Mongodb vs just storing the file on the server?
Upvotes: 0
Views: 572
Reputation: 39307
You can't "store it as a large string" in a MongoDB document because there is a limit on the document size.
Either use GridFS or store it in the file system and keep a reference to it in the database.
Upvotes: 1
Reputation: 17748
If the file is only needed long enough for it to be parsed, and you spawn a child process to do this (if an external binary is needed or even just to insulate the initial process), then you shouldn't need to store it in Mongo.
On the other hand, if there is any chance that your application will be working across more than one webserver, and more than one will need access to the data, then it's a good idea to throw it into Mongo.
In an ideal world, DXF would be streamable, and a Node library could be coded to accept an input stream piped from a request.
Upvotes: 1