Databases Reference
In-Depth Information
capable of referencing documents in any collection (or even database) without the de-
veloper having to know or remember what collection the referenced document might
reside in. DBRefs also enable drivers and tools to provide some more enhanced func-
tionality (e.g., automatic dereferencing) and could allow for more advanced support
on the server side in the future.
In short, the best times to use DBRefs are when you're storing heterogeneous references
to documents in different collections, like in the previous example or when you want
to take advantage of some additional DBRef-specific functionality in a driver or tool.
Otherwise, it's generally best to just store an "_id" and use that as a reference, because
that representation tends to be more compact and easier to work with.
 
Search WWH ::




Custom Search