Pre-26ai Collections
A pre-26ai collection is a collection created on a release earlier than 26ai, or by passing custom collection metadata.
It consists of a backing table or view together with collection metadata expressed in JSON, and stored separately in the Oracle Database data dictionary. Unlike a 26ai JSON collection table or view, the backing table or view is a conventional Oracle table or view. Pre-26ai collections continue to be supported for backward compatibility, including on 26ai, but all new applications should use 26ai JSON collection tables and views instead.
Documents in Pre-26ai Collections
The general document model described in Documents applies to pre-26ai collections, with the following differences:
- The document key is stored outside the document content, not inside under
_id. It can be auto-generated or supplied by the application. - Documents have two additional components not present in 26ai collections:
a creation timestamp and a last-modified timestamp, both automatically maintained by SODA. Document objects provide accessors for these values - the accessors return
nullfor documents retrieved from 26ai JSON collection tables and views. - Documents can contain non-JSON content. See Pre-26ai Collection Configuration for how to configure a collection to store non-JSON documents.
Creating and Dropping Pre-26ai Collections
Pre-26ai collections can be created, listed, written to, and dropped only through SODA APIs, not SQL. Their content, however, can be read from SQL.
When COMPATIBLE is set below 23, a pre-26ai collection is created by default. Such a collection has default metadata, which can vary depending on the database release and whether the database is Autonomous or conventional. The default configuration can also be overridden by passing custom metadata to the create collection operation. For details, see Pre-26ai Collection Confguration.
Caution: Do not drop a pre-26ai collection using SQL. Doing so drops only the backing table and leaves orphaned collection metadata in the data dictionary. To drop a pre-26ai collection, use the
DBMS_SODAPL/SQL API instead:select dbms_soda.drop_collection('collectionNameHere') from dual;
Operations on Pre-26ai Collections
The SODA APIs used with pre-26ai collections are the same as those used with 26ai JSON collection tables and views. This means that content in sections such as Operations on Document Collections applies equally to both collection types.
For a full list of differences between pre-26ai and 26ai Collections, see Differences between Pre-26ai and 26ai Collections