Getting Started
What is MongoDB?
Install / Config
C.R.U.D. Ops
Data Modeling
Database Mgmt
Data Modeling
One to One 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?
.
db.customers.insert({dbref_field:{"$ref":"collection","$id":ObjectId(of linked document),"$db":"database"});
How do you query data from a "DBRef"?
.
Use the appropriate class and method supplied by your driver
PHP: MongoCollection::getDBRef
+
o
-