0

We currently have a Postgres database which acts as our core/primary database for our web platform. This database stores registered user accounts (people who have signed up for an account on our site) as well as orders, purchases, etc...

We're now integrating a third-party system which uses a MongoDB database. The system is not connected to our web platform in any way, but will be capturing user data. The user data in the MongoDB will not be regareded as 'registered users' (like in our Postgres web platform), but if they were to create an account on our platform, we would ensure the same email was used.

I know both dbs are completelty different in structure, but I would like to see if it's possible to have the MongoDB data accessible within the Postgres database.

  • Is it technically possible to connect Postgres and MongoDB together in a way where we can see a link between user accounts in both DBs?
1

2 Answers 2

1

Is it technically possible to connect Postgres and MongoDB together in a way where we can see a link between user accounts in both DBs?

Not easily, natively.

You'll likely either need to build, buy your own ETL pipeline or replication service, or find a 3rd party extension (such as *mongo_fdw), to synchronize data from one to the other.

Some other database systems like Microsoft SQL Server offer features such as Linked Servers which allow you to directly query heterogeneous database systems e.g. MongoDB in real-time, but typically even those features can only function so well.


*Note this appears to be a free extension that is offered by a 3rd party company that primarily offers paid services. I am in no way affiliated with this company or software.

2
  • Okay, thanks for the advice @j-d!
    – AccDa
    Commented Jul 15, 2023 at 14:46
  • @AccDa np, best of luck!
    – J.D.
    Commented Jul 15, 2023 at 17:59
-1

You can install an ODBC driver for MongoDB and then connect from Postgres to MongoDB. However, looks like this is not so easy, see https://stackoverflow.com/questions/36350967/postgres-link-to-big-query-using-odbc-drivers

A list of available MongoDB ODBC drivers you can find at https://stackoverflow.com/questions/66122411/mongodb-connect-through-odbc/66122921#66122921

1
  • Why this complicated way if there is a MongoDB foreign data wrapper? Commented Jul 17, 2023 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.