Skip to main content

Description

The BSONEachRow format parses data as a sequence of Binary JSON (BSON) documents without any separator between them. Each row is formatted as a single document and each column is formatted as a single BSON document field with the column name as a key.

Data types matching

For output it uses the following correspondence between ClickHouse types and BSON types: For input it uses the following correspondence between BSON types and ClickHouse types: Other BSON types are not supported. Additionally, it performs conversion between different integer types. For example, it is possible to insert a BSON int32 value into ClickHouse as UInt8. Big integers and decimals such as Int128/UInt128/Int256/UInt256/Decimal128/Decimal256 can be parsed from a BSON Binary value with the \x00 binary subtype. In this case, the format will validate that the size of the binary data equals the size of the expected value.
This format does not work properly on Big-Endian platforms.

Example usage

Inserting data

Using a BSON file with the following data, named as football.bson:
Insert the data:

Reading data

Read data using the BSONEachRow format:
BSON is a binary format that does not display in a human-readable form on the terminal. Use the INTO OUTFILE to output BSON files.

Format settings

Last modified on June 19, 2026