Apache CouchDB is a schema-less document database that provides high performance, availability, and scalability. These features are not necessarily incompatible with a standards-compliant query language like SQL-92. The following sections show various schemes that the driver offers to bridge the gap with relational SQL and a document database.
Automatic Schema DiscoveryThe Automatic Schema Discovery scheme automatically finds the data types in an Apache CouchDB object by scanning a configured number of rows of the object. You can use RowScanDepth, FlattenArrays, and FlattenObjects to control the relational representation of the collections in Apache CouchDB.
Parsing Nested Data
The driver models the schemaless Apache CouchDB objects into relational tables and translates SQL queries into Apache CouchDB queries to get the requested data.
The schema of the table is necessary to report metadata, but you can write Free-Form Queries not tied to the schema to select, insert, update, or delete data from columns that do not exist in the schema (without flattening).
See Vertical Flattening to process JSON arrays as separate tables.
JSON FunctionsSee JSON Functions for query examples that can access specific nested data manually.
See Query Mapping for more details on how various Apache CouchDB operations are represented as SQL.