Getting Started with Couchbase Database
Connect to your Data
Metadata creation
The first step is to create the Couchbase Metadata.
-
Launch the Metadata creation wizard, then select Couchbase.
-
Select Couchbase Module and add the Couchbase Transactions library inside.
Adding this additional library to the Module is required as the component uses it. -
Click Finish.
-
Then, set the properties of the root node.
Property | Description | ||
---|---|---|---|
Name |
A label/alias for this cluster. |
||
Connection String |
The Couchbase connection string is a comma-delimited list of IP addresses and/or hostnames. 127.0.0.1 nodeA.example.com,nodeB.example.com nodeA.example.com:11210,nodeB.example.com:11210
|
||
Authentication Method |
The method used to authenticate with Couchbase. |
||
User |
The Couchbase user to connect with. |
||
Password |
The Couchbase password to connect with. |
||
Only Enable Plain Sasl Mechanism |
Enables only the PLAIN authentication mechanism, which is used with LDAP. |
||
Certificate Path |
Path to the certificate file to be used when Couchbase is secured with TLS. |
||
Reverse-engineering Sample Size |
The number of sample documents to parse to reverse-engineer the structure of documents. |
||
Reverse-engineering Automatic Index Creation Method |
This defines if indexes should be created before performing reverse-engineering. |
||
Reverse-engineering Automatic Index Cleanup |
This defines how to manage the cleanup of the indexes that have been automatically created during reverse-engineering. |
Below is an example:
Metadata Reverse-engineering
Each node of the Couchbase metadata offers the possibility to reverse-engineer its structure.
Right-click the desired node, then select > Actions > Reverse.
-
On the cluster node: All the buckets, scopes, collections, and underlying documents are reverse-engineered.
-
On a bucket node: All the scopes, collections, and underlying documents are reverse-engineered.
-
On a scope node: All the collections and underlying documents are reverse-engineered.
-
On a collection node: All the underlying documents are reverse-engineered.
Define a bucket node
To add a bucket node manually, right-click the server node, then select New > Bucket.
The following properties are available on this node:
Property | Description |
---|---|
Name |
A label/ alias for the bucket. |
Database Physical Name |
Bucket’s physical name, as defined on the cluster. |
You can reverse all the underlying scopes, collections, and documents. Right-click the bucket node, then select Actions > Reverse. |
Define a scope node
To add a scope node manually, right-click a bucket node, then select New > Scope.
Property | Description |
---|---|
Name |
A label/ alias for the scope. |
Scope Physical Name |
Scope’s physical name, as defined on the cluster. |
You can reverse all the underlying collections and documents. Right-click the scope node, choose Actions, then Reverse. |
Define a collection node
To add a collection node manually, right-click a scope node, then select New > Scope.
Property | Description |
---|---|
Name |
A label/ alias for the collection. |
Scope Physical Name |
Collection’s physical name, as defined on the cluster. |
You can reverse all the underlying documents. Right-click the collection node, then select Actions > Reverse. |
Define an FTS Query node
A Full-Text Search (FTS) Query node is a placeholder for a Couchbase FTS query.
To define an FTS Query:
-
Right-click the root node.
-
Select New > FTS Query.
-
Specify the query properties.
-
Optionally, add the limit and skip fields to define the pagination. The limit field allows you to specify the number of results to retrieve. The skip field allows you to specfiy the number of results to skip before the retrieving the results.
-
Right-click the FTS Query node, select Actions > Reverse. This runs the query and parses the response to get the metadata structure. This is optional. The results can also be designed manually.
Example:
The following properties are available:
Property | Description | ||
---|---|---|---|
Name |
Label for the FTS query. |
||
Index |
Name of the index to use for performing the FTS. |
||
Query Type |
Defines the FTS query type. Currently, only the queryString type is supported. |
||
Fields |
Comma-delimited list of fields to retrieve in the result of the FTS. Use a wildcard "*" to retrieve all the fields if it is supported by the defined index.
|
||
Query String |
The FTS Query String to be used. |
Create your first mappings
Write data into Couchbase
Couchbase collections can be loaded from any database.
-
Create a Mapping.
-
Drag and drop your source database table.
-
Drag and drop your target Couchbase document.
-
Map the fields between the source and the target.
-
Define the 'Couchbase Operation' of the Couchbase Template to the expected value.
Example:
Read data from Couchbase
You can read data from Couchbase and load it into a target table.
There are two ways to do this:
-
Read documents based on their ID.
-
Read the result of an FTS query.
Read documents
To read documents based on their ID:
-
Create a Mapping
-
Drag and drop:
-
The source table that will be used to iterate the Couchbase FTS Query.
-
The document to read.
-
The target table to load data into.
-
-
Map the root node of the Couchbase document/ FTS Query from the source.
-
Map the ID field with the ID of the documents to retrieve.
-
Map the fields between Couchbase and the target table as usual.
-
Define the 'Couchbase Operation' of the Couchbase Template to get.
Example:
Refer to the Template and parameters descriptions for further details. |
The source table calling Couchbase is used for the repetition key. Couchbase will be called once for each source row. |
Read an FTS query
To read the result of an FTS query:
-
Create a Mapping.
-
Drag and drop:
-
The source table that will be used to iterate the Couchbase documents to retrieve.
-
The FTS Query to read.
-
The target table to load data into.
-
-
Map the root node of the Couchbase FTS Query from the source.
-
Map the fields between Couchbase and the target table as usual
Example:
Refer to the Template and parameters descriptions for further details |
The source table calling Couchbase is used for the repetition key. Couchbase will be called once for each source row. |