As part of data remodeling, while moving from the relational model to the JSON model, you’ll have to consider the data type mapping. In Oracle, you’ll have to create and declare the types of each column explicitly before you load the data or write queries. In Couchbase, you simply conform to JSON syntax and the data type interpretation is automatic and implicit. Here’s the overview of mappings, conversion, and arithmetic on these data types.
ReModeling: From Relational to Document Model
Oracle | Couchbase | |
Model | Relational, Object-relational | JSON model with N1QL (SQL for JSON) |
Data Types | A long list of data types | https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/datatypes.html |
String Data types | CHAR, VARCHAR, VARCHAR2, NCHAR, NVARCHAR, LOONGVARCHAR | String, up to 20MB in length. All of the string data in JSON is Unicode. |
Date and Time Data Types | DATE, TIME, TIMESTAMP, all these with TIMEZONE, INTERVAL | Date, Time, Timestamp, all these with timezones should be represented in ISO 8601 format and saved as strings. N1QL has extensive functions for formatting, extraction, conversion, and arithmetic. |