title_wip

┌─count()─┐
│       2 │
└─────────┘
```

Note

The DDL overrides the named collection setting for options.

#### MongoDB Dictionary[​](#mongodb-dictionary "Direct link to MongoDB Dictionary")

```
CREATE DICTIONARY dict
(
    `a` Int64,
    `b` String
)
PRIMARY KEY a
SOURCE(MONGODB(NAME mymongo COLLECTION my_dict))
LIFETIME(MIN 1 MAX 2)
LAYOUT(HASHED())

SELECT dictGet('dict', 'b', 2);

┌─dictGet('dict', 'b', 2)─┐
│ two                     │
└─────────────────────────┘
```

Note

The named collection specifies `my_collection` for the collection name. In the function call it is overwritten by `collection = 'my_dict'` to select another collection.

- [Storing named collections in the system database](#storing-named-collections-in-the-system-database)
  - [DDL example](#ddl-example)- [Permissions to create named collections with DDL](#permissions-to-create-named-collections-with-ddl)- [Storage for named collections](#storage-for-named-collections)- [Storing named collections in configuration files](#storing-named-collections-in-configuration-files)
    - [XML example](#xml-example)- [Modifying named collections](#modifying-named-collections)
      - [Alter a DDL named collection](#alter-a-ddl-named-collection)- [Drop the DDL named collection `collection2`:](#drop-the-ddl-named-collection-collection2)- [Named collections for accessing S3](#named-collections-for-accessing-s3)
        - [DDL example](#ddl-example-1)- [XML example](#xml-example-1)- [s3() function and S3 Table named collection examples](#s3-function-and-s3-table-named-collection-examples)- [Named collections for accessing MySQL database](#named-collections-for-accessing-mysql-database)
          - [DDL example](#ddl-example-2)- [XML example](#xml-example-2)- [mysql() function, MySQL table, MySQL database, and Dictionary named collection examples](#mysql-function-mysql-table-mysql-database-and-dictionary-named-collection-examples)- [Named collections for accessing PostgreSQL database](#named-collections-for-accessing-postgresql-database)
            - [Example of using named collections with the postgresql function](#example-of-using-named-collections-with-the-postgresql-function)- [Example of using named collections with database with engine PostgreSQL](#example-of-using-named-collections-with-database-with-engine-postgresql)- [Example of using named collections with database with engine PostgreSQL](#example-of-using-named-collections-with-database-with-engine-postgresql-1)- [Example of using named collections with a dictionary with source POSTGRESQL](#example-of-using-named-collections-with-a-dictionary-with-source-postgresql)- [Named collections for accessing a remote ClickHouse database](#named-collections-for-accessing-a-remote-clickhouse-database)
              - [Example of using named collections with the `remote`/`remoteSecure` functions](#example-of-using-named-collections-with-the-remoteremotesecure-functions)- [Example of using named collections with a dictionary with source ClickHouse](#example-of-using-named-collections-with-a-dictionary-with-source-clickhouse)- [Named collections for accessing Kafka](#named-collections-for-accessing-kafka)
                - [DDL example](#ddl-example-3)- [XML example](#xml-example-3)- [Example of using named collections with a Kafka table](#example-of-using-named-collections-with-a-kafka-table)- [Named collections for backups](#named-collections-for-backups)
                  - [DDL example](#ddl-example-4)- [XML example](#xml-example-4)- [Named collections for accessing MongoDB Table and Dictionary](#named-collections-for-accessing-mongodb-table-and-dictionary)
                    - [DDL example](#ddl-example-5)- [XML example](#xml-example-5)

Was this page helpful?