Package com.mongodb
Class DBRef
java.lang.Object
com.mongodb.DBRef
- All Implemented Interfaces:
Serializable
A representation of a database reference.
- See Also:
- MongoDB documentation
- Database References
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance.Construct an instance.Method Summary
Modifier and TypeMethodDescriptionbooleanGets the name of the collection in which the referenced document is stored.Gets the name of the database in which the referenced document is stored.getId()Gets the _id of the referenced documentinthashCode()toString()-
Constructor Details
-
DBRef
Construct an instance.- Parameters:
collectionName- the name of the collection where the document is storedid- the object id
-
DBRef
Construct an instance.- Parameters:
databaseName- the name of the database where the document is storedcollectionName- the name of the collection where the document is storedid- the object id- Since:
- 3.3
-
-
Method Details
-
getId
Gets the _id of the referenced document- Returns:
- the _id of the referenced document
-
getCollectionName
Gets the name of the collection in which the referenced document is stored.- Returns:
- the name of the collection in which the referenced is stored
-
getDatabaseName
Gets the name of the database in which the referenced document is stored. A null value implies that the referenced document is stored in the same database as the referring document.- Returns:
- the possibly-null database name
- Since:
- 3.3
-
equals
- Overrides:
Object
-
hashCode
public int hashCode()- Overrides:
Object
-
toString
- Overrides:
Object
-