Skip to content

Document column type [Deprecated]

Manuel edited this page May 30, 2018 · 1 revision

FB DocStore is deprecated, and users will need to find alternative solutions.

To store JSON documents, we introduce a new column type "document". For example, you can create a table with a document column, just like any other column types.

-- the tables below will work for all test cases on this wiki
create table t1 (
    id int(8),
    doc document,
    primary key(id)
) engine=innodb;

-- now you can insert JSON data directly into a document column. 
insert into t1 values 
(1, '{"name":"Alex",
                 "street name":"main",
      "cars":["Ford", "Honda", "BMW"]}'),
(2, '{"name":"Jack Walters",
                 "street name":"main",
      "children":["Alex", "Ben", "Gary", "Jennifer"]}')

-- use for JOIN query examples
create table t2 engine=innodb as select * from t1;

Properties of the document column type

Below is a list of properties and current limitations of document column type.

  • JSON inserted into document column are always validated
  • Internally we convert JSON into a binary format. So white spaces in the input JSON will not matter and will be removed in storage.
  • The max size of a document column is up to 16MB.
  • A document column cannot be part of a primary index.
Clone this wiki locally
You can’t perform that action at this time.