I am currently working on a project in the hopes of learning MongoDB.
Reference fields like $ref
, $id
and $db
can reference other documents and collections and dynamically look for changes.
{
"_id":ObjectId("53402597d852426020000002"),
"address": {
"$ref": "address_home",
"$id": ObjectId("534009e4d852427820000002"),
"$db": "school"
},
"contact": "987654321",
"dob": "01-01-1991",
"name": "Tom Hanks"
}
In this scenario this particular document has a reference to a document in the collection ''address_home''
with the object id of 534009e4d852427820000002
.
Is these references less effective than PK/FK in popular RDBM's like PostgreSQL or MySQL, and why?