Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Oracle Database 23ai support for JSON Duality and Collection Views

This repository contains scripts demonstrating support for Oracle JSON views in Oracle Database 23ai and Oracle API for MongoDB


## Requirements
- mongosh installed
- SQL Cl installed
- Oracle Database 23ai with Oracle API for MongoDB enabled
- HR database sample schema installed

## License

Copyright (c) 2025 Oracle and/or its affiliates.

Licensed under the Universal Permissive License (UPL), Version 1.0.

See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
show collections

db.deptview.find()
db.deptview.insertOne({_id:'991',dname:'human resources',location:1700})

db.empview.find()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
select *
from user_json_collections;

soda list

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
drop view empview;
drop view deptview;
drop table departments cascade constraints;
drop table employees cascade constraints;

create table departments
as
select *
from hr.departments;

create table employees
as
select *
from hr.employees;

alter table departments add primary key(department_id);
alter table employees add primary key(employee_id);

create or replace json collection view empview
as
select json{'_id' : employee_id,
last_name,
hire_date,
salary}
from employees;

select *
from user_json_collections;

create or replace json relational duality view deptview as
select json {'_id' : department_id,
'dname' : department_name,
'location' : location_id}
from departments with insert update delete;