Here's a quick, two-script example of storing and retrieving the contents of a file in MongoDB.
import_script.rb: reads a file and stores it in MongoDB. Hardwired to use the 'neo4j' start-up script. You can change the name to be anything you want (just update the name that is stored in the 'document' variable too!).
get_script.rb: reads a file from MongoDB and writes it to the file system. Again, this example is hardwired to work with the neo4j script that was used in the import_script.rb file. You can once again update this code to work with any script that you have on your own computer.
These programs are written in Ruby and make use of the 'mongo' gem to access MongoDB.