[SF1] Lightning Connect to MongoDB with OData

As we have added more Lightning content to Trailhead, we started to have a need to create a few more test endpoints to use with Lightning Connect. Usually Connect will access some kind of middleware layer with OData support (Informatica, SAP, etc) or relational database with an OData layer (SQL Server) to get up and running. I wanted to see if we could quickly create an app on Heroku using nothing but node.js to make things little more lightweight.

It turns out, you can. This blog post from Appirio's Bryan Leboff is the best break down I can find. After a couple of hurdles I had test endpoint up and running against a MongoLab sandbox with a fairly simple node app.

A couple of caveats:

  1. As the comments on the blog post note, the JayData package being used here relies on a dated version of the mongodb package. Hence Brian's customized package.json handling. Without that handling you'll get some pretty obscure errors that arise deep within the packages.

  2. As I'm just now getting into MongoDb I am also just now getting into wonderful things like Mongoose. If you are going to use this with something like Mongoose you'll end up defining your data model multiple times (which sort of defeats the purpose).

So it works but now added to the relatively large pile of "projects I would love to do if I had the time" would be to rewrite the OData layer to talk directly to something like Mongoose and using the latest version of mongodb. This would make for an easier app that plays nicer with others.

comments powered by Disqus