As part of data refactoring, during the transition from relational model to JSON model, you will have to consider setting the datatype. In Oracle, you will have to explicitly create and declare the types of each column before loading data or writing queries. In Couchbase, you simply conform to the JSON syntax and the interpretation of the data type is automatic and implicit. Below is an overview of assignments, conversions, and calculations on these data types.
Reconfiguration: From relational to document model
Types of date and time
Oracle and other RDBMS systems have extensive data types for handling and processing time-related data. JSON does not have a date or datetime type. We chose ISO 8601. The idea is to store the date and time data in the form of a string corresponding to ISO 8601 and then process it in a consistent manner. Check out this blog with a detailed comparison of the Oracle types and the transform and format functions you can use in N1QL to extract and manipulate date and time data.
The primary key to convert the document key.
The key of a Couchbase document is always less than 255 bytes and is usually a string. An RDBMS can contain one or multiple (compound) columns of a table’s primary key. One common way to convert is to simply have a separator between the individual parts after converting each part to a string. The document key must be unique to the container, and therefore is usually prefixed with the type of table (group). See the blog for examples of how to do it right.