Simplifying NoSQL Database Integration with Jakarta NoSQL: A Hands-on Approach

Check out the presentation: aqui

Prerequisites to execute this project

Initialize MongoDB and Couchbase databases

  1. Initializing the MongoDB container:

    docker run -d --name mongodb-instance \
    -p 27017:27017 \
    -e MONGO_INITDB_ROOT_USERNAME=root \
    -e MONGO_INITDB_ROOT_PASSWORD=example mongo
  2. Initializing the Couchbase container:

    docker run -d --name db \
    -p 8091-8097:8091-8097 \
    -p 9123:9123 \
    -p 11207:11207 \
    -p 11210:11210 \
    -p 11280:11280 \
    -p 18091-18097:18091-18097 couchbase
  3. Optionally, you can initialize containers with Docker Compose:

    docker-compose up -d
  4. When you use Docker Compose, 3 containers will start up:

    • mongo (you can connect on it by following the connection properties at docker-compose.yml file)

    • mongo-express (use "admin:pass" to access it at: http://localhost:8081)

    • couchbase (to access it, take a look at below).

  5. The project uses Maven Wrapper, so it does not require you to have Maven pre-configured in your environment, so just run the Maven command below to build the project:

  6. .Linux/Mac:

    ./mvnw clean verify
  7. .Windows:

    mvnw.cmd clean verify
  8. Now, if you have Maven installed in your environment, then simply run the Maven command below to build the project:

    mvn clean verify

Configuring the Couchbase cluster

  1. With the Couchbase container started, go to: http://localhost:8091/ui/index.html

  2. Select the "Setup New Cluster" option

  3. Defines a name for the cluster name

  4. Set "root" to Admin username

  5. Set "123456" as Password

  6. Check "I accept the terms and conditions" and click the "Finish With Defaults" button

  7. Go to the "Buckets" section

  8. Create a "nosqlsp" Bucket by clicking on the "Add Bucket" option

  9. Click on "Scopes & Collections" and then click on "Add Collection"

  10. Enter "JakartaDeveloper" as the name of the collection and click the "Save" button to complete its creation

  11. Now, in the "Query" session, run this command N1QL to create the primary index of the "Developer" collection:

    CREATE PRIMARY INDEX primaryDeveloper ON nosqlsp._default.JakartaDeveloper