Skip to content

Commit 0a5bf20

Browse files
committed
Smooth the SODA overview and add links
1 parent 94a726b commit 0a5bf20

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

doc/api.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
512512
28. [End-to-end Tracing, Mid-tier Authentication, and Auditing](#endtoend)
513513
29. [Simple Oracle Document Access (SODA)](#sodaoverview)
514514
- 29.1 [Node-oracledb SODA Requirements](#sodarequirements)
515-
- 29.2 [Creating SODA Collections](#creatingsodacollections)
515+
- 29.2 [Creating and Dropping SODA Collections](#creatingsodacollections)
516516
- 29.3 [Creating and Accessing SODA documents](#accessingsodadocuments)
517517
- 29.4 [SODA Query-by-Example Searches for JSON Documents](#sodaqbesearches)
518518
- 29.5 [SODA Text Searches](#sodatextsearches)
@@ -12191,10 +12191,11 @@ Oracle Database 12.1.0.2 introduced native support for JSON data. You
1219112191
can use JSON with relational database features, including
1219212192
transactions, indexing, declarative querying, and views. You can
1219312193
project JSON data relationally, making it available for relational
12194-
processes and tools.
12194+
processes and tools. Also see [node-oracledb's SODA API](#sodaoverview), which
12195+
allows access to JSON documents through a set of NoSQL-style APIs.
1219512196

12196-
JSON data in the database is stored as BLOB, CLOB or VARCHAR2 data.
12197-
This means that node-oracledb can easily insert and query it.
12197+
JSON in relational tables is stored as BLOB, CLOB or VARCHAR2 data. This means
12198+
that node-oracledb can easily insert and query it.
1219812199

1219912200
As an example, the following table has a `PO_DOCUMENT` column that is
1220012201
enforced to be JSON:
@@ -14618,29 +14619,25 @@ that connection.
1461814619

1461914620
## <a name="sodaoverview"></a> 29. Simple Oracle Document Access (SODA)
1462014621

14621-
Oracle Database Simple Oracle Document Access (SODA) is available in
14622-
node-oracledb through a set of NoSQL-style APIs. Documents can be inserted,
14623-
queried, and retrieved from Oracle Database using node-oracledb methods. By
14624-
default, documents are JSON strings.
14625-
14626-
The [Oracle Database Introduction to SODA][103] manual contains much
14627-
information relevant to using SODA. You can use Oracle SODA
14628-
implementations in Node.js, [Python][106], [Java][105], [PL/SQL][104]
14629-
or [Oracle Call Interface][107] to perform operations on documents of
14630-
nearly any kind (including video, image, sound, and other binary
14631-
content). Create, read, update and delete operations can be performed
14632-
via document key lookups, or by query-by-example (QBE)
14633-
pattern-matching.
14634-
14635-
SODA uses a SQL schema to store documents but you do not need to know
14636-
SQL or how the documents are stored. However, access via SQL does
14637-
allow use of advanced Oracle Database functionality such as analytics
14638-
for reporting.
14639-
14640-
Applications that access a mixture of SODA objects and relational
14641-
objects (or access SODA objects via SQL) are supported, but be aware
14642-
of the commit behavior, since any commit or rollback on a connection
14643-
will affect all work.
14622+
Oracle Database Simple Oracle Document Access (SODA) documents can be inserted,
14623+
queried, and retrieved from Oracle Database through NoSQL-style APIs. By
14624+
default, documents are JSON strings but can be nearly any kind, including video,
14625+
image, sound, and other binary content. Create, read, update and delete
14626+
operations can be performed via document key lookups, or by query-by-example
14627+
(QBE) pattern-matching.
14628+
14629+
SODA internally uses a SQL schema to store documents but you do not need to know
14630+
SQL or how the documents are stored. However, optional access via SQL does allow
14631+
use of advanced Oracle Database functionality such as analytics for reporting.
14632+
Applications that access a mixture of SODA objects and relational objects (or
14633+
access SODA objects via SQL) are supported.
14634+
14635+
Oracle SODA implementations are also available in [Python][106], [Java][105],
14636+
[PL/SQL][104], [Oracle Call Interface][107] and via [REST][191]. The [Simple
14637+
Oracle Document Access][103] homepage contains much information relevant to
14638+
using SODA.
14639+
14640+
#### Node-oracledb SODA Objects
1464414641

1464514642
Node-oracledb uses the following objects for SODA:
1464614643

@@ -14649,8 +14646,8 @@ Node-oracledb uses the following objects for SODA:
1464914646
Database connection. A 'SODA database' is an abstraction, allowing
1465014647
access to SODA collections in that 'SODA database', which then allow
1465114648
access to documents in those collections. A SODA database is
14652-
analogous to an Oracle Database user or schema, a collection is
14653-
analogous to a table, and a document is analogous to a table row
14649+
analogous to an Oracle Database user or schema. A collection is
14650+
analogous to a table. A document is analogous to a table row
1465414651
with one column for a unique document key, a column for the document
1465514652
content, and other columns for various document attributes.
1465614653

@@ -14706,25 +14703,27 @@ The `CREATE TABLE` system privilege is also needed. Advanced users
1470614703
who are using Oracle sequences for keys will also need the `CREATE
1470714704
SEQUENCE` privilege.
1470814705

14706+
#### Committing SODA Work
14707+
1470914708
The general recommendation for SODA applications is to turn on
1471014709
[`autoCommit`](#propdbisautocommit) globally:
1471114710

1471214711
```javascript
1471314712
oracledb.autoCommit = true;
1471414713
```
1471514714

14716-
If your SODA document write operations are mostly independent of each
14717-
other, this removes the overhead of explicit
14718-
[`connection.commit()`](#commit) calls.
14715+
If your SODA document write operations are mostly independent of each other,
14716+
this removes the overhead of application transaction management and the need for
14717+
explicit [`connection.commit()`](#commit) calls.
1471914718

1472014719
When deciding how to commit transactions, beware of transactional consistency
1472114720
and performance requirements. If you are using individual SODA calls to insert
1472214721
or update a large number of documents with individual calls, you should turn
1472314722
`autoCommit` off and issue a single, explicit [`connection.commit()`](#commit)
14724-
after all documents have been processed. (Also consider using
14723+
after all documents have been processed. Also consider using
1472514724
[`sodaCollection.insertMany()`](#sodacollinsertmany) or
1472614725
[`sodaCollection.insertManyAndGet()`](#sodacollinsertmanyandget) which have
14727-
performance benefits).
14726+
performance benefits.
1472814727

1472914728
If you are not autocommitting, and one of the SODA operations in your
1473014729
transaction fails, then previous uncommitted operations will not be rolled back.
@@ -14737,8 +14736,9 @@ Note:
1473714736
- SODA DDL operations do not commit an open transaction the way that SQL always does for DDL statements.
1473814737
- When [`oracledb.autoCommit`](#propdbisautocommit) is *true*, most SODA methods will issue a commit before successful return.
1473914738
- SODA provides optimistic locking, see [`sodaOperation.version()`](#sodaoperationclassversion).
14739+
- When mixing SODA and relational access, any commit or rollback on the connection will affect all work.
1474014740

14741-
### <a name="creatingsodacollections"></a> 29.2 Creating SODA Collections
14741+
### <a name="creatingsodacollections"></a> 29.2 Creating and Dropping SODA Collections
1474214742

1474314743
The following examples use Node.js 8's
1474414744
[async/await](#asyncawaitoverview) syntax, however callbacks can also
@@ -16380,9 +16380,9 @@ can be asked at [AskTom][158].
1638016380
[100]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-ABC7AE4D-64A8-4EA9-857D-BEF7300B64C3
1638116381
[101]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-2BEF5482-CF97-4A85-BD90-9195E41E74EF
1638216382
[102]: https://github.com/oracle/node-oracledb/issues/886
16383-
[103]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=ADSDI
16383+
[103]: https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/index.html
1638416384
[104]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=ADSDP
16385-
[105]: https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/java-1/adsda/index.html
16385+
[105]: https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/java/adsda/index.html
1638616386
[106]: https://cx-oracle.readthedocs.org/en/latest/index.html
1638716387
[107]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-23206C89-891E-43D7-827C-5C6367AD62FD
1638816388
[108]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-CB09C4E3-BBB1-40DC-88A8-8417821B0FBE
@@ -16467,3 +16467,4 @@ can be asked at [AskTom][158].
1646716467
[188]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=TGDBA
1646816468
[189]: https://github.com/oracle/node-oracledb/tree/master/examples/webapp.js
1646916469
[190]: https://www.oracle.com/technetwork/database/options/clustering/applicationcontinuity/continuous-service-for-apps-on-atpd-5486113.pdf
16470+
[191]: https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/rest/index.html

0 commit comments

Comments
 (0)