Search code examples
node.jsmongodbdocpad

Docpad and connecting to MongoDb


I want my docpad website to use a mongoDb rather than the file system for the storage of documents (Heroku deployment). Is there a docpad plugin for this? I can't seem to find a straight forward way of getting docpad to use mongo. I've already looked at Need explanation for Docpad persistence - but that doesn't give the actual technical details of achieving the connection


Solution

  • I am not aware of any mongodb plugin. The easiest starting point might be to take the tubmlr plugin and adapt it to read form mongodb instead of from the tumblr rss/atom feeds.

    The code for that plugin is not terribly complex. First, you'd want to replace the fetchTumblrData function with one that gets data from MongoDB instead and then you'd want to adapt the code in populateCollections to turn that data into virtual documents.