JSON collections

A JSON collection is a named grouping of JSON documents. Document structures in a collection might differ significantly. However, documents in a collection are usually of a similar nature to enable finding and grouping data.

Collections are represented in a Db2® table with a custom-defined or automatically generated unique identifier and a binary large object to hold the semi-structured document content. A collection can be created explicitly with the createCollection() command, or implicitly when an insert is attempted for a collection that did not previously exist.

Starting from Db2 Cancun Release 10.5.0.4, document identifiers that serve as primary key can be of different type in the documents of a collection. By default, the document identifiers that serve as primary key can be of different data type for different collections, but must be of the same data type for all documents in a collection. For more information on how to allow different data types for the primary key of a collection, go to Configuring JSON runtime parameters. Using different data types for the primary key in a collection can result in an adverse performance impact.