@@ -512,7 +512,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
512
512
28. [End-to-end Tracing, Mid-tier Authentication, and Auditing](#endtoend)
513
513
29. [Simple Oracle Document Access (SODA)](#sodaoverview)
514
514
- 29.1 [Node-oracledb SODA Requirements](#sodarequirements)
515
- - 29.2 [Creating SODA Collections](#creatingsodacollections)
515
+ - 29.2 [Creating and Dropping SODA Collections](#creatingsodacollections)
516
516
- 29.3 [Creating and Accessing SODA documents](#accessingsodadocuments)
517
517
- 29.4 [SODA Query-by-Example Searches for JSON Documents](#sodaqbesearches)
518
518
- 29.5 [SODA Text Searches](#sodatextsearches)
@@ -12191,10 +12191,11 @@ Oracle Database 12.1.0.2 introduced native support for JSON data. You
12191
12191
can use JSON with relational database features, including
12192
12192
transactions, indexing, declarative querying, and views. You can
12193
12193
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.
12195
12196
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.
12198
12199
12199
12200
As an example, the following table has a `PO_DOCUMENT` column that is
12200
12201
enforced to be JSON:
@@ -14618,29 +14619,25 @@ that connection.
14618
14619
14619
14620
## <a name="sodaoverview"></a> 29. Simple Oracle Document Access (SODA)
14620
14621
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
14644
14641
14645
14642
Node-oracledb uses the following objects for SODA:
14646
14643
@@ -14649,8 +14646,8 @@ Node-oracledb uses the following objects for SODA:
14649
14646
Database connection. A 'SODA database' is an abstraction, allowing
14650
14647
access to SODA collections in that 'SODA database', which then allow
14651
14648
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
14654
14651
with one column for a unique document key, a column for the document
14655
14652
content, and other columns for various document attributes.
14656
14653
@@ -14706,25 +14703,27 @@ The `CREATE TABLE` system privilege is also needed. Advanced users
14706
14703
who are using Oracle sequences for keys will also need the `CREATE
14707
14704
SEQUENCE` privilege.
14708
14705
14706
+ #### Committing SODA Work
14707
+
14709
14708
The general recommendation for SODA applications is to turn on
14710
14709
[`autoCommit`](#propdbisautocommit) globally:
14711
14710
14712
14711
```javascript
14713
14712
oracledb.autoCommit = true;
14714
14713
```
14715
14714
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.
14719
14718
14720
14719
When deciding how to commit transactions, beware of transactional consistency
14721
14720
and performance requirements. If you are using individual SODA calls to insert
14722
14721
or update a large number of documents with individual calls, you should turn
14723
14722
`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
14725
14724
[`sodaCollection.insertMany()`](#sodacollinsertmany) or
14726
14725
[`sodaCollection.insertManyAndGet()`](#sodacollinsertmanyandget) which have
14727
- performance benefits) .
14726
+ performance benefits.
14728
14727
14729
14728
If you are not autocommitting, and one of the SODA operations in your
14730
14729
transaction fails, then previous uncommitted operations will not be rolled back.
@@ -14737,8 +14736,9 @@ Note:
14737
14736
- SODA DDL operations do not commit an open transaction the way that SQL always does for DDL statements.
14738
14737
- When [`oracledb.autoCommit`](#propdbisautocommit) is *true*, most SODA methods will issue a commit before successful return.
14739
14738
- 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.
14740
14740
14741
- ### <a name="creatingsodacollections"></a> 29.2 Creating SODA Collections
14741
+ ### <a name="creatingsodacollections"></a> 29.2 Creating and Dropping SODA Collections
14742
14742
14743
14743
The following examples use Node.js 8's
14744
14744
[async/await](#asyncawaitoverview) syntax, however callbacks can also
@@ -16380,9 +16380,9 @@ can be asked at [AskTom][158].
16380
16380
[100]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-ABC7AE4D-64A8-4EA9-857D-BEF7300B64C3
16381
16381
[101]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-2BEF5482-CF97-4A85-BD90-9195E41E74EF
16382
16382
[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
16384
16384
[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
16386
16386
[106]: https://cx-oracle.readthedocs.org/en/latest/index.html
16387
16387
[107]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-23206C89-891E-43D7-827C-5C6367AD62FD
16388
16388
[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].
16467
16467
[188]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=TGDBA
16468
16468
[189]: https://github.com/oracle/node-oracledb/tree/master/examples/webapp.js
16469
16469
[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