Package com.mongodb

Class DBRef

  • All Implemented Interfaces:

    public class DBRef
    extends 
    implements 
    A representation of a database reference.
    See Also:
    Serialized Form
    MongoDB documentation
    • Constructor Summary

      Constructors 
      Constructor Description
       collectionName,  id)
      Construct an instance.
       databaseName,  collectionName,  id)
      Construct an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean  o)  
      getCollectionName()
      Gets the name of the collection in which the referenced document is stored.
      getDatabaseName()
      Gets the name of the database in which the referenced document is stored.
      getId()
      Gets the _id of the referenced document
      int hashCode()  
      toString()  
      • Methods inherited from class java.lang.

        , , , , , , ,
    • Constructor Detail

      • DBRef

        public DBRef​( collectionName,
                      id)
        Construct an instance.
        Parameters:
        collectionName - the name of the collection where the document is stored
        id - the object id
      • DBRef

        public DBRef​(@Nullable
                      databaseName,
                      collectionName,
                      id)
        Construct an instance.
        Parameters:
        databaseName - the name of the database where the document is stored
        collectionName - the name of the collection where the document is stored
        id - the object id
        Since:
        3.3
    • Method Detail

      • getId

        public  getId()
        Gets the _id of the referenced document
        Returns:
        the _id of the referenced document
      • getCollectionName

        public  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

        @Nullable
        public  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

        public boolean equals​( o)
        Overrides:
         in class 
      • hashCode

        public int hashCode()
        Overrides:
         in class 
      • toString

        public  toString()
        Overrides:
         in class