MongoDB as file storage for a Grails application

I recently came up with the need to store more files in my application, and since the PaaS platform used to host the application provides Mongo, I would like to use it.

However, since I am fairly inexperienced with mongo, I hardly know what the current state of mongo-related plugins and grail tools is. What should I use? Since I want to store the domain classes in a SQL database and only use mongo to store related files (in this case it will be basically a bunch of PDFs and text documents associated with the domain instance), the mongoDB ORM plugin [1] seems too "heavy" Unfortunately, the mongoDB ORM is perhaps the only mongo grail plugin that is actively developing at the moment.

In short, what would be the best plugin / library toolkit for this purpose? The closest thing that suits my need I found is the grails-mongo-files [2] plugin, which is probably a little outdated without further development. Far off it seems to me that I'll have to use the mongo java driver (or gmongo wrapper) and write some storage services and taglibs myself (which isn't necessarily a bad thing).

[1] http://grails.org/plugin/mongodb

[2] https://github.com/quirklabs/grails-mongo-file

+3


source to share


1 answer


There is also a mododb gridfs plugin. http://grails.org/plugin/mongodb-gridfs

Be aware that gridfs effectively makes two calls to mongo, one to retrieve information about a file and one to retrieve a file. Thus, it may not be very convenient if your files are no more than 16 megabytes.



Here is a post on how to do it manually if you want to bypass plugins - http://jameswilliams.be/blog/entry/171

0


source







All Articles