I use symfony on my web page, I want to use both mongodb
and mysql
in my database model, and i don't know how to link between a table on my sql and a document on mongodb.
Example: PERSON
-- relation 1--n -- ADDRESS
, where PERSON
is a table on my mysql
database and ADDRESS
is a document on mongodb
.
Is it possible? How can I do it? Thank you.
Not possible if you want to have as strong a relation as e.g. foreign key constraints. The two databases will never have immediate knowledge of each other's data, transactions (!), scopes, etc. You can carefully write code that synchronizes the two. One approach I find easy and reliable: (for the reference, documents are data block of NoSQL [entities in NoSQL] while records are data items of SQL [entities in SQL])
In this manner the two databases can be used in sync, relatively safely with transactions and locking.