Skip to content

Commit ded91ab

Browse files
Fixed incorrect info, and added some additions.
1 parent 3ddc4f2 commit ded91ab

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

source/applications/database-references.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ MongoDB applications use one of two methods for relating documents:
2424
cases.
2525

2626
#. :ref:`DBRefs <dbref>` are references from one document to another
27-
using an ObjectId, and collection and database names for the target
28-
document. Resolving DBRefs requires two queries from your
27+
using its _id field value, and collection, and (possibly) a database name, for the target
28+
document. Resolving DBRefs requires queries from your
2929
application; however, many :doc:`drivers </applications/drivers>`
30-
automatically resolve DBRefs. DBRefs are useful when you need to
31-
embed documents from multiple collections in documents from one
32-
collection.
30+
have helper methods to resolve DBRefs without having to form the query manually.
31+
No official driver automatically resolves DBRefs to documents for you; some frameworks and toolkits
32+
provide automatically linking and (link) resolution if you wish to use these features.
33+
DBRefs are useful when you need to embed documents from multiple collections in documents from one
34+
collection. They also provide a common format and type for tools which can represent the link semantics provided
35+
in your documents, or for interactions between frameworks which store linked documents.
3336

3437
Unless you have a compelling reason for using DBrefs, use manual
3538
references.
@@ -98,8 +101,7 @@ Background
98101
DBRefs are a convention for representing a :term:`document`, rather
99102
than a specific reference "type." They include the name of the
100103
collection, and in some cases the database, in addition to the
101-
``ObjectId``. Some :term:`drivers <driver>` also have support for
102-
automatic resolution of DBRef references.
104+
value from the _id field.
103105

104106
Format
105107
~~~~~~
@@ -134,7 +136,7 @@ Thus a DBRef document would resemble the following:
134136
.. note::
135137

136138
The order of fields in the DBRef matter, and you must use the above
137-
sequence when creating a DBRef.
139+
sequence when using a DBRef.
138140

139141
Support
140142
~~~~~~~
@@ -155,7 +157,7 @@ Support
155157

156158
**JavaScrpt**
157159
The :program:`mongo` shell's :doc:`JavaScript </reference/javascript>`
158-
interface provides automatic resolution of DBRef objects.
160+
interface provides a DBRef.
159161

160162
**Perl**
161163
The Perl driver contains no support for DBRefs. You can transverse
@@ -167,8 +169,7 @@ Support
167169
`The MongoDBRef class <http://www.php.net/manual/en/class.mongodbref.php/>`_.
168170

169171
**Python**
170-
The Python driver supports automatic resolution of DBRef
171-
relationships, and provides the :api:`DBref class <python/current/api/bson/dbref.html>`,
172+
The Python driver provides the :api:`DBref class <python/current/api/bson/dbref.html>`,
172173
and the :api:`dereference method </python/current/api/pymongo/database.html#pymongo.database.Database.dereference>`
173174
for interacting with DBRefs.
174175

0 commit comments

Comments
 (0)