B 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.
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 JSON 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
}
Note:
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
}
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.
-
The following example specifies client-assigned keys. Otherwise, the default settings are used.
{
"keyColumn" :
{
"name" : "ID",
"sqlType" : "VARCHAR2",
"maxLength" : 255,
"assignmentMethod" : "CLIENT"
},
"contentColumn" :
{
"name" : "JSON_DOCUMENT",
"sqlType" : "BLOB",
"jsonFormat" : "OSON"
},
"versionColumn" :
{
"name" : "VERSION",
"method" : "UUID"
},
"lastModifiedColumn" :
{
"name" : "LAST_MODIFIED"
},
"creationTimeColumn" :
{
"name" : "CREATED_ON"
},
"readOnly" : false
}