A Step by Step Introduction to
the MySQL Document Store
Dave Stokes
Community Manager
MySQL CommunityTeam
Copyright © 2019 Oracle and/or its affiliates.
The following is intended to outline our general product direction. It is intended for information purposes only,
and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or
functionality, and should not be relied upon in making purchasing decisions.The development, release,
timing, and pricing of any features or functionality described for Oracle’s products may change and remains at
the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects
are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of
these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange
Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading
“Risk Factors.”These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and
Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Reminder
MySQL 5.6
End of Life is February 2021!
Please UPDATE!!!!
Copyright © 2019 Oracle and/or its affiliates.
Two years!
MySQL 8.0 was
released just over
two years ago.
Copyright © 2019 Oracle and/or its affiliates.
The prep work that needs to be done before using traditional relational database before you can save data
Normalize data Create relational
tables, indexes,
foreign keys,
views, etc.
Then you can
connect top the
database
Copyright © 2019 Oracle and/or its affiliates.
Now with the MySQL Document Store
Connect to server
Copyright © 2019 Oracle and/or its affiliates.
A Step by Step Introduction to the MySQL Document Store
The MySQL Document Store is a fast and easy way
to start storing your data as soon as you connect to
the MySQL.
It is a NoSQL document database that stores your
data in JSON, does not require you to fight SQL
syntax, and is designed to be easy to use.
Copyright © 2019 Oracle and/or its affiliates.
With Document Store
You connect to the
MySQL server and
schema of your
choice.
Create or use an
existing document
collection to store
your data as a
JSON document.
And since this
format is easy to
change it grows
with you.
Copyright © 2019 Oracle and/or its affiliates.
You can literally be saving your data in just seven commands
1. Create user
2. Grant privileges on a schema
3. Login to server using mysqlsh
4. Create schema
5. Use schema
6. Create collection
7. Add data
Copyright © 2019 Oracle and/or its affiliates.
1. create user 'davetest'@'localhost'
identified by 'PassW0rd';
2. grant all on mytest.* to
'davetest'@'localhost';
3. c davetest@localhost
4. session.createSchema('mytest')
5. session.setCurrentSchema('mytest')
6. db.createCollection('mycol')
7. db.mycol.add( { "first" : "record" })
Didn’t you say it was schema-less?
• Traditional RDMS schemas are ‘hard coded’ and require a lot of
effort to change the tables.
• NoSQL schemas are like bank vaults to hold your data.
Copyright © 2019 Oracle and/or its affiliates.
The new MySQL Shell, AKA mysqlsh
Copyright © 2019 Oracle and/or its affiliates.
Connect (c) to the server as root@localhost and connect to schema ‘demo’
Copyright © 2019 Oracle and/or its affiliates.
The schema ‘demo’ is referenced by a pointer named ‘db’
Copyright © 2019 Oracle and/or its affiliates.
Concepts
• Schemas hold document collections
• Document Collections hold documents
Documents are stored in JSON format
1GB payload
No required fields (sort of – explained later)
Highly mutable!
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
We login as ‘root@localhost’ to the demo schema
And create a collection named webinar
Copyright © 2019 Oracle and/or its affiliates.
Then we add a document
Copyright © 2019 Oracle and/or its affiliates.
We have been able to
add data without any
of the traditional
prerequisites needed
with a database and
all without any SQL!
Where this matters
1. You do not have perfect knowledge of the data
2. Developers with little or no SQL skills
3. Limited DBA skills
4. Data is highly mutable
5. Limited windows of opportunity to restructure data
Copyright © 2019 Oracle and/or its affiliates.
Simple, intuitive API
Copyright © 2019 Oracle and/or its affiliates.
Simple, intuitive API
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
CRUD based API is easy to use, matches modern programming
designs, and works across popular languages.
Copyright © 2019 Oracle and/or its affiliates.
Need to add a new key/value pair?
Copyright © 2019 Oracle and/or its affiliates.
Lets add a new key/value pair
Copyright © 2019 Oracle and/or its affiliates.
And double check our work
Copyright © 2019 Oracle and/or its affiliates.
Taa-Daa!!
Copyright © 2019 Oracle and/or its affiliates.
But what if you like SQL?!?
Copyright © 2019 Oracle and/or its affiliates.
The New Shell speaks SQL
Copyright © 2019 Oracle and/or its affiliates.
And the data can be processed with SQL
Copyright © 2019 Oracle and/or its affiliates.
What About SQL Data From NoSQL
Copyright © 2019 Oracle and/or its affiliates.
Yes, you can use relational
tables from the NoSQL side
Or the NoSQL data from the SQL side
In any combination that makes sense for your data!
Some other options to consider
• You can make the NoSQL data temporarily structured data (for
SQL PROCESSING) with JSON_TABLE()
• You can make the NoSQL permanently structured data with a
generated column
• Use NoSQL where it makes sense and use SQL where it makes
sense with the same data on the same platform!
Copyright © 2019 Oracle and/or its affiliates.
Some general questions
The following are some general questions
users of traditional relation databases are
probably wondering about right now…
Copyright © 2019 Oracle and/or its affiliates.
Are transactions available?
Copyright © 2019 Oracle and/or its affiliates.
Are transactions available?
Copyright © 2019 Oracle and/or its affiliates.
Are transactions available?
Copyright © 2019 Oracle and/or its affiliates.
Yes: Use rollback()or commit()
Copyright © 2019 Oracle and/or its affiliates.
What versions of MySQL are supported?
 Introduced with MySQL 5.7 but not installed by default
 Much improved in MySQL 8.0 and installed by default
 X DevAPI has several new features not found in the traditional MySQL
Protocol and based on Google Protobufs
 ‘Listens’ on port 33060 instead of 3306
 Not an Object Relational Mapper but a true new protocol
 A new high-level session concept enables you to write code that can
transparently scale from single MySQL Server to a multiple server
environment
 Non-blocking, asynchronous calls follow common host language
patterns.
Copyright © 2019 Oracle and/or its affiliates.
_id
• You can supply your own values or let system generate
• Can not be changed after creation
• InnoDB primary key
• Three fields
• Prefix 4 bytes – unique across InnoDB Cluster or zero
• StartupTimestamp 8 bytes
• Serial 16 bytes
Copyright © 2019 Oracle and/or its affiliates.
What programming languages do you support?
Copyright © 2019 Oracle and/or its affiliates.
PHP
<?php
$marco = [
"name" => "Marco",
"age" => 19,
"job" => "Programmer"
];
$mike = [
"name" => "Mike",
"age" => 39,
"job" => "Manager"
];
$schema = $session->getSchema("test");
$collection = $schema->getCollection("example");
$collection->add($marco, $mike)->execute();
var_dump($collection->find("name = 'Mike'")->execute()->fetchOne());
?>
Copyright © 2019 Oracle and/or its affiliates.
C++#include <mysqlx/xdevapi.h>
// Scope controls life-time of objects such as session or schema
{
Session sess("localhost", 33060, "user", "password");
Schema db = sess.getSchema("test");
// or Schema db(sess, "test");
Collection myColl = db.getCollection("my_collection");
// or Collection myColl(db, "my_collection");
DocResult myDocs = myColl.find("name like :param") .limit(1)
.bind("param","L%").execute();
cout << myDocs.fetchOne();
}
Copyright © 2019 Oracle and/or its affiliates.
Java
import com.mysql.cj.xdevapi.*;
// Connect to server on localhost
Session mySession = new SessionFactory().getSession("mysqlx://localhost:33060/test?user=user&password=password");
Schema myDb = mySession.getSchema("test");
// Use the collection 'my_collection'
Collection myColl = myDb.getCollection("my_collection");
// Specify which document to find with Collection.find() and
// fetch it from the database with .execute()
DocResult myDocs = myColl.find("name like :param").limit(1).bind("param", "L%").execute();
// Print document
System.out.println(myDocs.fetchOne());
mySession.close();
Copyright © 2019 Oracle and/or its affiliates.
Python
import mysqlx
# Connect to server on localhost
my_session = mysqlx.get_session({ 'host': 'localhost',
'port': 33060, 'user': 'user',
'password': 'password' })
my_schema = my_session.get_schema('test')
# Use the collection 'my_collection'
my_coll = my_schema.get_collection('my_collection')
# Specify which document to find with Collection.find() and # fetch it from the
database with .execute()
docs = my_coll.find('name like :param').limit(1).bind('param', 'L%').execute()
# Print document
doc = docs.fetch_one() print(doc)
my_session.close()
Copyright © 2019 Oracle and/or its affiliates.
Node.js
var mysqlx = require('@mysql/xdevapi');
// Connect to server on localhost
mysqlx
.getSession({
user: 'user',
password: 'password',
host: 'localhost',
port: '33060' })
.then(function (session) {
var db = session.getSchema('test');
// Use the collection 'my_collection'
var myColl = db.getCollection('my_collection');
// Specify which document to find with Collection.find() and
// fetch it from the database with .execute()
return myColl
.find('name like :param')
.limit(1)
.bind('param', 'L%')
.execute(function (doc) { console.log(doc);
});
}) .catch(function (err) {
// Handle error
});
Copyright © 2019 Oracle and/or its affiliates.
JavaScript
var mysqlx = require('mysqlx');
// Connect to server on localhost
var mySession = mysqlx.getSession( { host: 'localhost',
port: 33060,
user: 'user',
password: 'password' } );
var myDb = mySession.getSchema('test');
// Use the collection 'my_collection'
var myColl = myDb.getCollection('my_collection');
// Specify which document to find with Collection.find() and
// fetch it from the database with .execute()
var myDocs = myColl.find('name like :param').limit(1). bind('param',
'L%').execute();
// Print document
print(myDocs.fetchOne());
mySession.close();
Copyright © 2019 Oracle and/or its affiliates.
Indexes
Indexes can greatly speed up searching and the MySQL Document
Store provides several different ways to index you data
Copyright © 2019 Oracle and/or its affiliates.
Indexes
db.b.createIndex("nbr_idx",
{fields:[{"field": "$.nbr", "type":"INT", required:true}]}
);
Copyright © 2019 Oracle and/or its affiliates.
Multi Value Indexes
mysql> CREATE TABLE s (id INT UNSIGNED AUTO_INCREMENT
PRIMARY KEY,
-> name CHAR(20) NOT NULL,
-> j JSON,
-> INDEX nbrs( (CAST(j->'$.nbr' AS UNSIGNED ARRAY)))
-> );
Query OK, 0 rows affected (0.11 sec)
Copyright © 2019 Oracle and/or its affiliates.
No longer bound by one record per each index entry
Required Fields
CREATE TABLE `testx` (
`col` JSON,
CONSTRAINT `myage_inRange`
CHECK (JSON_SCHEMA_VALID(
'{"type": "object",
"properties": {
"myage": {
"type" : "number",
"minimum": 28,
"maximum": 99
}
},"required": ["myage"]
}', `col`) = 1)
);
Copyright © 2019 Oracle and/or its affiliates.
mysql> insert into testx values('{"myage":27}');
ERROR 3819 (HY000): Check constraint 'myage_inRange' is violated.
mysql> insert into testx values('{"myage":97}');
Query OK, 1 row affected (0.02 sec)
This was supposed to be a
brief overview of the
MySQL Document Store
• So I will not drill down into too many details
• Lots of material was not covered
• So where do we get details?
Copyright © 2019 Oracle and/or its affiliates.
Resources
• Downloads - https://www.mysql.com/downloads/
• Documentation - https://dev.mysql.com/doc/
• X DevAPI User Guide - https://dev.mysql.com/doc/x-devapi-userguide/en/
• MySQL Shell - https://dev.mysql.com/doc/mysql-shell/8.0/en/
• Forums - https://forums.mysql.com/
• Slack – https://mysqlcommunity.slack.com
• ShortVideoTutorials - https://www.youtube.com/user/davestokestexas/videos
Copyright © 2019 Oracle and/or its affiliates.
ThankYou
Dave Stokes
Community Manager
MySQL CommunityTeam
David.Stokes @ Oracle.com
https://elephantdolphin.blogspot.com/
@Stoker
The preceding is intended to outline our general product direction. It is intended for information purposes only,
and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or
functionality, and should not be relied upon in making purchasing decisions.The development, release,
timing, and pricing of any features or functionality described for Oracle’s products may change and remains at
the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects
are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of
these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange
Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading
“Risk Factors.”These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and
Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.

A Step by Step Introduction to the MySQL Document Store

  • 1.
    A Step byStep Introduction to the MySQL Document Store Dave Stokes Community Manager MySQL CommunityTeam Copyright © 2019 Oracle and/or its affiliates.
  • 2.
    The following isintended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.”These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 3.
    Reminder MySQL 5.6 End ofLife is February 2021! Please UPDATE!!!! Copyright © 2019 Oracle and/or its affiliates.
  • 4.
    Two years! MySQL 8.0was released just over two years ago. Copyright © 2019 Oracle and/or its affiliates.
  • 5.
    The prep workthat needs to be done before using traditional relational database before you can save data Normalize data Create relational tables, indexes, foreign keys, views, etc. Then you can connect top the database Copyright © 2019 Oracle and/or its affiliates.
  • 6.
    Now with theMySQL Document Store Connect to server Copyright © 2019 Oracle and/or its affiliates.
  • 7.
    A Step byStep Introduction to the MySQL Document Store The MySQL Document Store is a fast and easy way to start storing your data as soon as you connect to the MySQL. It is a NoSQL document database that stores your data in JSON, does not require you to fight SQL syntax, and is designed to be easy to use. Copyright © 2019 Oracle and/or its affiliates.
  • 8.
    With Document Store Youconnect to the MySQL server and schema of your choice. Create or use an existing document collection to store your data as a JSON document. And since this format is easy to change it grows with you. Copyright © 2019 Oracle and/or its affiliates.
  • 9.
    You can literallybe saving your data in just seven commands 1. Create user 2. Grant privileges on a schema 3. Login to server using mysqlsh 4. Create schema 5. Use schema 6. Create collection 7. Add data Copyright © 2019 Oracle and/or its affiliates. 1. create user 'davetest'@'localhost' identified by 'PassW0rd'; 2. grant all on mytest.* to 'davetest'@'localhost'; 3. c davetest@localhost 4. session.createSchema('mytest') 5. session.setCurrentSchema('mytest') 6. db.createCollection('mycol') 7. db.mycol.add( { "first" : "record" })
  • 10.
    Didn’t you sayit was schema-less? • Traditional RDMS schemas are ‘hard coded’ and require a lot of effort to change the tables. • NoSQL schemas are like bank vaults to hold your data. Copyright © 2019 Oracle and/or its affiliates.
  • 11.
    The new MySQLShell, AKA mysqlsh Copyright © 2019 Oracle and/or its affiliates.
  • 12.
    Connect (c) tothe server as root@localhost and connect to schema ‘demo’ Copyright © 2019 Oracle and/or its affiliates.
  • 13.
    The schema ‘demo’is referenced by a pointer named ‘db’ Copyright © 2019 Oracle and/or its affiliates.
  • 14.
    Concepts • Schemas holddocument collections • Document Collections hold documents Documents are stored in JSON format 1GB payload No required fields (sort of – explained later) Highly mutable! Copyright © 2019 Oracle and/or its affiliates.
  • 15.
    Copyright © 2019Oracle and/or its affiliates. We login as ‘root@localhost’ to the demo schema And create a collection named webinar
  • 16.
    Copyright © 2019Oracle and/or its affiliates. Then we add a document
  • 17.
    Copyright © 2019Oracle and/or its affiliates. We have been able to add data without any of the traditional prerequisites needed with a database and all without any SQL!
  • 18.
    Where this matters 1.You do not have perfect knowledge of the data 2. Developers with little or no SQL skills 3. Limited DBA skills 4. Data is highly mutable 5. Limited windows of opportunity to restructure data Copyright © 2019 Oracle and/or its affiliates.
  • 19.
    Simple, intuitive API Copyright© 2019 Oracle and/or its affiliates.
  • 20.
    Simple, intuitive API Copyright© 2019 Oracle and/or its affiliates.
  • 21.
    Copyright © 2019Oracle and/or its affiliates. CRUD based API is easy to use, matches modern programming designs, and works across popular languages.
  • 22.
    Copyright © 2019Oracle and/or its affiliates. Need to add a new key/value pair?
  • 23.
    Copyright © 2019Oracle and/or its affiliates. Lets add a new key/value pair
  • 24.
    Copyright © 2019Oracle and/or its affiliates. And double check our work
  • 25.
    Copyright © 2019Oracle and/or its affiliates. Taa-Daa!!
  • 26.
    Copyright © 2019Oracle and/or its affiliates.
  • 27.
    But what ifyou like SQL?!? Copyright © 2019 Oracle and/or its affiliates.
  • 28.
    The New Shellspeaks SQL Copyright © 2019 Oracle and/or its affiliates.
  • 29.
    And the datacan be processed with SQL Copyright © 2019 Oracle and/or its affiliates.
  • 30.
    What About SQLData From NoSQL Copyright © 2019 Oracle and/or its affiliates. Yes, you can use relational tables from the NoSQL side Or the NoSQL data from the SQL side In any combination that makes sense for your data!
  • 31.
    Some other optionsto consider • You can make the NoSQL data temporarily structured data (for SQL PROCESSING) with JSON_TABLE() • You can make the NoSQL permanently structured data with a generated column • Use NoSQL where it makes sense and use SQL where it makes sense with the same data on the same platform! Copyright © 2019 Oracle and/or its affiliates.
  • 32.
    Some general questions Thefollowing are some general questions users of traditional relation databases are probably wondering about right now… Copyright © 2019 Oracle and/or its affiliates.
  • 33.
    Are transactions available? Copyright© 2019 Oracle and/or its affiliates.
  • 34.
    Are transactions available? Copyright© 2019 Oracle and/or its affiliates.
  • 35.
    Are transactions available? Copyright© 2019 Oracle and/or its affiliates.
  • 36.
    Yes: Use rollback()orcommit() Copyright © 2019 Oracle and/or its affiliates.
  • 37.
    What versions ofMySQL are supported?  Introduced with MySQL 5.7 but not installed by default  Much improved in MySQL 8.0 and installed by default  X DevAPI has several new features not found in the traditional MySQL Protocol and based on Google Protobufs  ‘Listens’ on port 33060 instead of 3306  Not an Object Relational Mapper but a true new protocol  A new high-level session concept enables you to write code that can transparently scale from single MySQL Server to a multiple server environment  Non-blocking, asynchronous calls follow common host language patterns. Copyright © 2019 Oracle and/or its affiliates.
  • 38.
    _id • You cansupply your own values or let system generate • Can not be changed after creation • InnoDB primary key • Three fields • Prefix 4 bytes – unique across InnoDB Cluster or zero • StartupTimestamp 8 bytes • Serial 16 bytes Copyright © 2019 Oracle and/or its affiliates.
  • 39.
    What programming languagesdo you support? Copyright © 2019 Oracle and/or its affiliates.
  • 40.
    PHP <?php $marco = [ "name"=> "Marco", "age" => 19, "job" => "Programmer" ]; $mike = [ "name" => "Mike", "age" => 39, "job" => "Manager" ]; $schema = $session->getSchema("test"); $collection = $schema->getCollection("example"); $collection->add($marco, $mike)->execute(); var_dump($collection->find("name = 'Mike'")->execute()->fetchOne()); ?> Copyright © 2019 Oracle and/or its affiliates.
  • 41.
    C++#include <mysqlx/xdevapi.h> // Scopecontrols life-time of objects such as session or schema { Session sess("localhost", 33060, "user", "password"); Schema db = sess.getSchema("test"); // or Schema db(sess, "test"); Collection myColl = db.getCollection("my_collection"); // or Collection myColl(db, "my_collection"); DocResult myDocs = myColl.find("name like :param") .limit(1) .bind("param","L%").execute(); cout << myDocs.fetchOne(); } Copyright © 2019 Oracle and/or its affiliates.
  • 42.
    Java import com.mysql.cj.xdevapi.*; // Connectto server on localhost Session mySession = new SessionFactory().getSession("mysqlx://localhost:33060/test?user=user&password=password"); Schema myDb = mySession.getSchema("test"); // Use the collection 'my_collection' Collection myColl = myDb.getCollection("my_collection"); // Specify which document to find with Collection.find() and // fetch it from the database with .execute() DocResult myDocs = myColl.find("name like :param").limit(1).bind("param", "L%").execute(); // Print document System.out.println(myDocs.fetchOne()); mySession.close(); Copyright © 2019 Oracle and/or its affiliates.
  • 43.
    Python import mysqlx # Connectto server on localhost my_session = mysqlx.get_session({ 'host': 'localhost', 'port': 33060, 'user': 'user', 'password': 'password' }) my_schema = my_session.get_schema('test') # Use the collection 'my_collection' my_coll = my_schema.get_collection('my_collection') # Specify which document to find with Collection.find() and # fetch it from the database with .execute() docs = my_coll.find('name like :param').limit(1).bind('param', 'L%').execute() # Print document doc = docs.fetch_one() print(doc) my_session.close() Copyright © 2019 Oracle and/or its affiliates.
  • 44.
    Node.js var mysqlx =require('@mysql/xdevapi'); // Connect to server on localhost mysqlx .getSession({ user: 'user', password: 'password', host: 'localhost', port: '33060' }) .then(function (session) { var db = session.getSchema('test'); // Use the collection 'my_collection' var myColl = db.getCollection('my_collection'); // Specify which document to find with Collection.find() and // fetch it from the database with .execute() return myColl .find('name like :param') .limit(1) .bind('param', 'L%') .execute(function (doc) { console.log(doc); }); }) .catch(function (err) { // Handle error }); Copyright © 2019 Oracle and/or its affiliates.
  • 45.
    JavaScript var mysqlx =require('mysqlx'); // Connect to server on localhost var mySession = mysqlx.getSession( { host: 'localhost', port: 33060, user: 'user', password: 'password' } ); var myDb = mySession.getSchema('test'); // Use the collection 'my_collection' var myColl = myDb.getCollection('my_collection'); // Specify which document to find with Collection.find() and // fetch it from the database with .execute() var myDocs = myColl.find('name like :param').limit(1). bind('param', 'L%').execute(); // Print document print(myDocs.fetchOne()); mySession.close(); Copyright © 2019 Oracle and/or its affiliates.
  • 46.
    Indexes Indexes can greatlyspeed up searching and the MySQL Document Store provides several different ways to index you data Copyright © 2019 Oracle and/or its affiliates.
  • 47.
    Indexes db.b.createIndex("nbr_idx", {fields:[{"field": "$.nbr", "type":"INT",required:true}]} ); Copyright © 2019 Oracle and/or its affiliates.
  • 48.
    Multi Value Indexes mysql>CREATE TABLE s (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, -> name CHAR(20) NOT NULL, -> j JSON, -> INDEX nbrs( (CAST(j->'$.nbr' AS UNSIGNED ARRAY))) -> ); Query OK, 0 rows affected (0.11 sec) Copyright © 2019 Oracle and/or its affiliates. No longer bound by one record per each index entry
  • 49.
    Required Fields CREATE TABLE`testx` ( `col` JSON, CONSTRAINT `myage_inRange` CHECK (JSON_SCHEMA_VALID( '{"type": "object", "properties": { "myage": { "type" : "number", "minimum": 28, "maximum": 99 } },"required": ["myage"] }', `col`) = 1) ); Copyright © 2019 Oracle and/or its affiliates. mysql> insert into testx values('{"myage":27}'); ERROR 3819 (HY000): Check constraint 'myage_inRange' is violated. mysql> insert into testx values('{"myage":97}'); Query OK, 1 row affected (0.02 sec)
  • 50.
    This was supposedto be a brief overview of the MySQL Document Store • So I will not drill down into too many details • Lots of material was not covered • So where do we get details? Copyright © 2019 Oracle and/or its affiliates.
  • 51.
    Resources • Downloads -https://www.mysql.com/downloads/ • Documentation - https://dev.mysql.com/doc/ • X DevAPI User Guide - https://dev.mysql.com/doc/x-devapi-userguide/en/ • MySQL Shell - https://dev.mysql.com/doc/mysql-shell/8.0/en/ • Forums - https://forums.mysql.com/ • Slack – https://mysqlcommunity.slack.com • ShortVideoTutorials - https://www.youtube.com/user/davestokestexas/videos Copyright © 2019 Oracle and/or its affiliates.
  • 52.
    ThankYou Dave Stokes Community Manager MySQLCommunityTeam David.Stokes @ Oracle.com https://elephantdolphin.blogspot.com/ @Stoker
  • 53.
    The preceding isintended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.”These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.