com.mongodb
Class DBRef

java.lang.Object
  extended by com.mongodb.DBRefBase
      extended by com.mongodb.DBRef

public class DBRef
extends DBRefBase

overrides DBRefBase to understand a BSONObject representation of a reference.


MongoDB Doc Links

Constructor Summary
DBRef(DB db, BSONObject o)
          Creates a DBRef
DBRef(DB db, String ns, Object id)
          Creates a DBRef
 
Method Summary
static DBObject fetch(DB db, DBObject ref)
          fetches a referenced object from the database
 
Methods inherited from class com.mongodb.DBRefBase
equals, fetch, getDB, getId, getRef, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBRef

public DBRef(DB db,
             BSONObject o)
Creates a DBRef

Parameters:
db - the database
o - a BSON object representing the reference

DBRef

public DBRef(DB db,
             String ns,
             Object id)
Creates a DBRef

Parameters:
db - the database
ns - the namespace where the object is stored
id - the object id
Method Detail

fetch

public static DBObject fetch(DB db,
                             DBObject ref)
fetches a referenced object from the database

Parameters:
db - the database
ref - the reference
Returns:
Throws:
MongoException