Storing documents in a MongoDB database instead of the file system


Storing documents in a MongoDB database instead of the file system

We are currently working on an application that uses a mysql database. The application produces a large number of csv files that must be kept around for a few weeks, and then removed after being used in various ways by the users of the system.

We need to keep track of all of these files and present a list of the files to the user so they can download them to their local machine, or send them to other systems as needed.  We need to track when the file was created, who created it, and other information.

We considered a few alternatives for managing these files;  We could keep then on the file system and have scripts that keep the database synchoronized with the file system. Or we could load each file into a blob type and keep it in the mysql database. Either of these options will work fine if we are careful. But we are seeking something more.

Our research led us to MongoDB. An open source document oriented database.

MongoDB claims to bridge the gap between key-value stores which are typically used by high volume web applications that have simple data storage requirements, and traditional RDBMS database systems.

In addition to simple queries based on key-value pairs, you can use boolean expressions, regular expressions, set operations, and sorting and limiting. MongoDB also has the ability to grab documents directly from the file system using its gridFS functionality.

We have not implemented MongoDB for this project yet but it looks very promising.

I will send updates as we get closer.

Posted on Categories Database, MySQLTags , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *