类 MongoNamespace


  • 公共最终类MongoNamespace扩展了对象
    MongoDB 命名空间,包括数据库名称和collection名称。
    • 字段详细信息

      • COMMAND_COLLECTION_NAME

        public static final string COMMAND_COLLECTION_NAME
        另请参阅:
        常量字段值
    • 方法详细信息

      • checkDatabaseNameValidity

        public static void checkDatabaseNameValidity​( string databaseName)
        检查给定数据库名称的有效性。 有效的数据库名称为非 null、非空且不包含以下任何字符: '\0', '/', '\\', ' ', '"', '.' 。 服务器可能会对数据库名称施加其他限制。
        参数:
        databaseName - 数据库名称
        抛出异常:
        IllegalArgumentException - 如果数据库名称无效
      • checkCollectionNameValidity

        public static void checkCollectionNameValidity​( string collectionName)
        检查给定collection名称的有效性。有效的collection名称为非 null 且非空。服务器可能会对collection名称施加其他限制。
        参数:
        collectionName - 集合名称
        抛出异常:
        IllegalArgumentException - 如果collection名称无效
      • getDatabaseName

        公共string getDatabaseName ()
        获取数据库名称。
        返回:
        数据库名称
      • getCollectionName

        public String getCollectionName()
        获取集合名称。
        返回:
        collection名称
      • getFullName

        公共string getFullName ()
        获取全名,即数据库名称和collection名称,用句点分隔。
        返回:
        全名
      • toString

        public String toString()
        返回命名空间的标准 MongoDB 表示形式,即<database>.<collection>
        覆盖:
        toString 课堂上 Object
        返回:
        命名空间的字符串表示形式。
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 课堂上 Object