Reputation: 1380
I am currently developing an application in node.js. I have a Postgres/PostGIS database to store geospatial information and render them as SVG. That works fine so far. On the other side I have a CouchDB database filled with data, from a previous project.
I'd like to combine this data with the geospatial data from postgis via node.js, but I am not sure on how to proceed with the structure of my databases.
Is it a good idea to work with two different database types - even paradigms - in one application? Or is is better to transform the data from one db to the other?
BTW: This is purely a hobby project.
Upvotes: 11
Views: 4089
Reputation: 38781
There's nothing wrong with accessing two databases from one application. It's a model used frequently. It's not uncommon to have a Node server access both Mongodb and Redis, using each for their strengths. You just have to tie data relations together in your app instead of in the database.
Node is particularly suited for multi-database applications because you can access multiple resources simultaneously. The async package makes it easy to query multiple databases at the same time and merge the results. This is something that synchronous servers typically do in order, waiting for one result before sending off the query for the second result. So if you take full advantage of Node's capabilities, you'll have a better experience accessing multiple data sources then you would from many other popular web development platforms.
Upvotes: 12