Getting Started
What is MongoDB?
Install / Config
C.R.U.D. Ops
Data Modeling
Database Mgmt
Data Modeling
One to Many Relationships: DBRef Approach
What is a "DBRef"
.
A convention for representing a document in another collection
What are the restrictions in using the "DBRef" approach?
.
Not all programming language drivers support this
DBRefs supported in: C#, Java, JavaScript, PHP, Python, Ruby
DBRefs NOT supported in: C, C++ and perl
How do you store data using the "DBRef" approach?
.
var id = ObjectId()
db.child_collection.insert({_id:id, field:value})
db.parent_collection.insert({dbref_field:{"$ref":"parent_collection","$id":id,"$db":name_of_child_database"})
How do you query data from a "DBRef"?
.
Use the appropriate class supplied by your driver
+
o
-