segunda-feira, 10 de julho de 2023

[Oracle Autonomous JSON] How to configure and using the Oracle API for MongoDB on Oracle Autonomous JSON Database - Part 2

 Hello everyone

In my last post, I presented how you can configure the Oracle Autonomous JSON Database to use the API for MongoDB.

And today, we're going to use the API to connect into MongoDB shell, create a simple collection and use those documents in the ADJ console.

If you want to see the first post, feel free to click here

But always remember:

  1. This step-by-step worked for me, but it may not work for you.
  2. It's a basic and limited environment. The real life will be different, for sure.
  3. This post is for study and testing as well, and has no concern for performance and security best practices.

I have a MongoDB Intance in OCI Compute and I'm going to connect MongoSH in my ADJ using the connection string that I created in the first post. My user is named ADMIN:

mongosh -u admin -p XXXZZZ 'mongodb://XXZZZ-IRONMAN.adb.sa-saopaulo-1.oraclecloudapps.com:27017/admin?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'

I'll create a new collection and a new document using MongoSH. After that I'll create a new document using ADJ console and at the end I'll select this data in the console and MongoSH as well.

This example was adapted from the post "SQL NESTED Clause Instead of JSON_TABLE in Oracle Database 19c" from amazing ORACLE-BASE

So, let's get started!!!

1) I'll connect in MongoSH using my connection string:


2) Now, I'll access the ADJ console. Click on the "Database Actions" button and select the option "JSON".

  


3) First, I'll create a new decument in the MongoSH shell.



4) The second document will be created in the ADJ console. For this, click in "New" button in the ADJ console.


Click on the "Create" button and he massage bellow should appear.


And now, I have 2 documents in my collection.


And for read operations, I have two options:

1)  Click on the "Database Actions" button and select the option "SQL".


2) I'll create my SQL queries with the same SQL statements used in relational databases.


Using NESTED and WHERE, for example.


3) Finally, I may read my documents usinf MongoDB statements, for shure!!!


It's really cool, right!!!

In the next post, I'll show you how enabling REST is easy in ADJ.

I hope this post will help you!!!

Regards
Mario

Nenhum comentário:

Postar um comentário

Isso te ajudou? Comente...

Postagem em destaque

[ORACLE] Batch change EDITIONABLE property.

Hello everyone. Hope you're doing well! Today, I have a simple case.   A test database had many database objects with the EDITIONABLE pr...