Settings

Theme

Ask HN: Is there a easy connector between MongoDB and Postgres?

2 points by singlepaynews 3 months ago · 3 comments · 1 min read

Reader

I have a postgres schema for relating authors, posts, comments, likes, follows, and all kinds of stuff that works great for relational queries.

The articles table in particular is great, with the exception of the "body" column, where all the sudden I'm hosting a large markdown file.

I want to have an "article_bodies" table in MongoDB that holds many [article_id:article_body] entries, which in my understanding is what MongoDB was made for. I'm thinking this will open higher performance from my postgres, while allowing me to keep writing relational queries everywhere.

Is there a fast and easy way to connect my pg "articles" table to a mongo "articles" table? I'm using PostgREST to host the rest API, will this have the performance impact I'm expecting?

I'm a self-taught webdev, but it seems like more or less everything is either best served by a relational db or a document db, with mongo and postgres being the most widely used standards. Are there any projects/companies dedicated to supporting tooling that links these two? Could we finally be done building new databases?

steffan 3 months ago

[I work for MongoDB] For your use case, I would consider just holding all of the data in MongoDB. With an appropriate data model, you'd be able to quickly retrieve the information you need for the initial page display as well as article details.

This isn't to say that there aren't use cases that might be better served by either database or a combination, but for your particular use, you may not be gaining enough to offset the added complexity of using two different databases.

Obv. I'm biased, but I would recommend using MongoDB :)

Here's a reference for some design patterns to consider: https://www.mongodb.com/company/blog/building-with-patterns-...

njnewsman 3 months ago

there are foreign data wrappers for MongoDB. Check github

zaktoo2 3 months ago

Foreign data wrappers

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection