SODA Collection Metadata
It describes SODA Collection metadata on the database.
- SODA Collection Metadata on Autonomous Database
Describes default and customized collection metadata on Autonomous Database.
Parent topic: Reference
SODA Collection Metadata on Autonomous Database
Describes default and customized collection metadata on Autonomous Database.
- SODA Default Collection Metadata on Autonomous Database
Describes the default collection metadata on Autonomous Database, that is the metadata for a collection that is added when custom metadata is not supplied. - SODA Customized Collection Metadata on Autonomous Database
Describes SODA collection custom metadata on Autonomous Database.
Parent topic: SODA Collection Metadata
SODA Default Collection Metadata on Autonomous Database
Describes the default collection metadata on Autonomous Database, that is the metadata for a collection that is added when custom metadata is not supplied.
Each SODA implementation provides a way to create a default collection
when you supply a collection name. For example, in SODA for Java you use the
createCollection
method and supply just a collection name
parameter:
db.admin().createCollection("myCol");
This creates a collection with default collection metadata. When you create a default collection on your database, the collection metadata includes the following information (regardless of which SODA implementation you use to create the default collection):
{
"keyColumn" :
{
"name" : "ID",
"sqlType" : "VARCHAR2",
"maxLength" : 255,
"assignmentMethod" : "UUID"
},
"contentColumn" :
{
"name" : "JSON_DOCUMENT",
"sqlType" : "BLOB",
"jsonFormat" : "OSON"
},
"versionColumn" :
{
"name" : "VERSION",
"method" : "UUID"
},
"lastModifiedColumn" :
{
"name" : "LAST_MODIFIED"
},
"creationTimeColumn" :
{
"name" : "CREATED_ON"
},
"readOnly" : false
}
Using Always Free Autonomous Database with Oracle Database 23ai, the default metadata changes as follows.
{
"keyColumn" :
{
"name" : "ID",
"sqlType" : "VARCHAR2",
"maxLength" : 255,
"assignmentMethod" : "UUID"
},
"contentColumn" :
{
"name" : "JSON_DOCUMENT",
"sqlType" : "JSON",
},
"versionColumn" :
{
"name" : "VERSION",
"method" : "UUID"
},
"lastModifiedColumn" :
{
"name" : "LAST_MODIFIED"
},
"creationTimeColumn" :
{
"name" : "CREATED_ON"
},
"readOnly" : false
}
Parent topic: SODA Collection Metadata on Autonomous Database
SODA Customized Collection Metadata on Autonomous Database
Describes SODA collection custom metadata on Autonomous Database.
Each SODA implementation provides a way to customize the collection metadata during collection creation. For example, in SODA for Java, you can use the following command:
OracleDocument metadata = db.createDocumentFromString("metadata_string");
OracleCollection col = db.admin().createCollection("myCustomColl", metadata);
In this example, for metadata_string
you can use
the default metadata as the starting point, and customize the following:
-
Change
keyColumn.assignmentMethod
toCLIENT
: Change the value of theassignmentMethod
underkeyColumn
in the metadata toCLIENT
(instead ofUUID
).Valid values for
keyColumn.assignmentMethod
on Autonomous Database:-
UUID (default): Keys are generated by SODA, based on the
UUID
. -
CLIENT: Keys are assigned by the client application.
-
-
Provide a
mediaTypeColumn
name
value: A media type column is needed if the collection is to be heterogeneous, that is, it can store documents other than JavaScript Object Notation (JSON). See Media Type Column Name for details.
The following example specifies
client-assigned keys and a custom media type column. The
mediaTypeColumn
name
is specified with the value
YOUR_MEDIA_TYPE_COLUMN_NAME. Otherwise, the default settings are used.
{
"keyColumn" :
{
"name" : "ID",
"sqlType" : "VARCHAR2",
"maxLength" : 255,
"assignmentMethod" : "CLIENT"
},
"contentColumn" :
{
"name" : "JSON_DOCUMENT",
"sqlType" : "BLOB"
},
"versionColumn" :
{
"name" : "VERSION",
"method" : "UUID"
},
"lastModifiedColumn" :
{
"name" : "LAST_MODIFIED"
},
"creationTimeColumn" :
{
"name" : "CREATED_ON"
},
"mediaTypeColumn" :
{
"name" : "YOUR_MEDIA_TYPE_COLUMN_NAME"
},
"readOnly" : false
}
Parent topic: SODA Collection Metadata on Autonomous Database