DEV Community

Discussion on: MySQL or MongoDB? What to Choose for your Next Project?

Collapse
 
kirandhakal25 profile image
Kiran Dhakal • Edited

The fourth point in the differences, you've written that mongoDB uses two methods to create the Associations, first is the reference type and the other one is the use of foreign key same like that of MySQL database.
Here, you've mentioned the same type. Referencing is where you use foreign key like feature. The another way to create a relationship is embedding.

Collapse
 
abdurrkhalid333 profile image
Abdur Rehman Khalid

Hmm, I guess I should have used an example there,

Let's say you have the Relation of Book and Authors so in MongoDB you can do it in the following two ways:

book {
authors: [
"Author1",
"Author2"
]
}

And Also by this way

book {
authors: [
......ids here.
]
}

so this is a minute difference.