Submit Search
Upload
MySQL Connector/Node.js and the X DevAPI
•
1 like
•
795 views
Rui Quelhas
Follow
Using NoSQL and CRUD operations with MySQL on the Node.js platform.
Read less
Read more
Software
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 41
Download now
Download to read offline
Recommended
Node.js and the MySQL Document Store
Node.js and the MySQL Document Store
Rui Quelhas
MySQL Document Store and Node.JS
MySQL Document Store and Node.JS
Reggie Burnett
MySQL Document Store (Oracle Code Warsaw 2018)
MySQL Document Store (Oracle Code Warsaw 2018)
Vittorio Cioe
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
Olivier DASINI
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
Engineering practices in big data storage and processing
Engineering practices in big data storage and processing
Schubert Zhang
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Zohar Elkayam
Mysql8for blr usercamp
Mysql8for blr usercamp
Mysql User Camp
Recommended
Node.js and the MySQL Document Store
Node.js and the MySQL Document Store
Rui Quelhas
MySQL Document Store and Node.JS
MySQL Document Store and Node.JS
Reggie Burnett
MySQL Document Store (Oracle Code Warsaw 2018)
MySQL Document Store (Oracle Code Warsaw 2018)
Vittorio Cioe
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
Olivier DASINI
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
Engineering practices in big data storage and processing
Engineering practices in big data storage and processing
Schubert Zhang
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Zohar Elkayam
Mysql8for blr usercamp
Mysql8for blr usercamp
Mysql User Camp
Big data for cio 2015
Big data for cio 2015
Zohar Elkayam
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Zohar Elkayam
Adding real time reporting to your database oracle db in memory
Adding real time reporting to your database oracle db in memory
Zohar Elkayam
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Marco Gralike
Horizon for Big Data
Horizon for Big Data
Schubert Zhang
Hadoop & no sql new generation database systems
Hadoop & no sql new generation database systems
ramazan fırın
Understanding Oracle GoldenGate 12c
Understanding Oracle GoldenGate 12c
IT Help Desk Inc
MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014
Avinash Ramineni
Storlets fb session_16_9
Storlets fb session_16_9
Eran Rom
9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
Nosql data models
Nosql data models
Viet-Trung TRAN
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
ArangoDB Database
Hibernate
Hibernate
vaishnavmem
NoSQL Slideshare Presentation
NoSQL Slideshare Presentation
Ericsson Labs
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
DataStax
NoSQL Introduction
NoSQL Introduction
John Kerley-Weeks
Netezza online training at GoLogica
Netezza online training at GoLogica
GoLogica Technologies
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
Databricks
The Evolution of Open Source Databases
The Evolution of Open Source Databases
Ivan Zoratti
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
DataStax
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Filipe Silva
MySQL 8 loves JavaScript
MySQL 8 loves JavaScript
Sanjay Manwani
More Related Content
What's hot
Big data for cio 2015
Big data for cio 2015
Zohar Elkayam
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Zohar Elkayam
Adding real time reporting to your database oracle db in memory
Adding real time reporting to your database oracle db in memory
Zohar Elkayam
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Marco Gralike
Horizon for Big Data
Horizon for Big Data
Schubert Zhang
Hadoop & no sql new generation database systems
Hadoop & no sql new generation database systems
ramazan fırın
Understanding Oracle GoldenGate 12c
Understanding Oracle GoldenGate 12c
IT Help Desk Inc
MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014
Avinash Ramineni
Storlets fb session_16_9
Storlets fb session_16_9
Eran Rom
9. Document Oriented Databases
9. Document Oriented Databases
Fabio Fumarola
Nosql data models
Nosql data models
Viet-Trung TRAN
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
ArangoDB Database
Hibernate
Hibernate
vaishnavmem
NoSQL Slideshare Presentation
NoSQL Slideshare Presentation
Ericsson Labs
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
DataStax
NoSQL Introduction
NoSQL Introduction
John Kerley-Weeks
Netezza online training at GoLogica
Netezza online training at GoLogica
GoLogica Technologies
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
Databricks
The Evolution of Open Source Databases
The Evolution of Open Source Databases
Ivan Zoratti
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
DataStax
What's hot
(20)
Big data for cio 2015
Big data for cio 2015
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Adding real time reporting to your database oracle db in memory
Adding real time reporting to your database oracle db in memory
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Horizon for Big Data
Horizon for Big Data
Hadoop & no sql new generation database systems
Hadoop & no sql new generation database systems
Understanding Oracle GoldenGate 12c
Understanding Oracle GoldenGate 12c
MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014
Storlets fb session_16_9
Storlets fb session_16_9
9. Document Oriented Databases
9. Document Oriented Databases
Nosql data models
Nosql data models
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
Hibernate
Hibernate
NoSQL Slideshare Presentation
NoSQL Slideshare Presentation
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
NoSQL Introduction
NoSQL Introduction
Netezza online training at GoLogica
Netezza online training at GoLogica
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of Open Source Databases
The Evolution of Open Source Databases
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
Building a Distributed Reservation System with Cassandra (Andrew Baker & Jeff...
Similar to MySQL Connector/Node.js and the X DevAPI
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Filipe Silva
MySQL 8 loves JavaScript
MySQL 8 loves JavaScript
Sanjay Manwani
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
Olivier DASINI
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?
Olivier DASINI
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
Cloud Native Day Tel Aviv
MySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document Store
Olivier DASINI
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
Andrew Morgan
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
Olivier DASINI
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
Olivier DASINI
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPI
Dave Stokes
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
Ivan Ma
MySQL Document Store
MySQL Document Store
Mario Beck
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
Geir Høydalsvik
Mysql NDB Cluster's Asynchronous Parallel Design for High Performance
Mysql NDB Cluster's Asynchronous Parallel Design for High Performance
Bernd Ocklin
What's New in MySQL 8.0 @ HKOSC 2017
What's New in MySQL 8.0 @ HKOSC 2017
Ivan Ma
Solution Use Case Demo: The Power of Relationships in Your Big Data
Solution Use Case Demo: The Power of Relationships in Your Big Data
InfiniteGraph
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
Georgi Kodinov
Novinky v Oracle Database 18c
Novinky v Oracle Database 18c
MarketingArrowECS_CZ
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018
Olivier DASINI
Similar to MySQL Connector/Node.js and the X DevAPI
(20)
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
MySQL 8 loves JavaScript
MySQL 8 loves JavaScript
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
MySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document Store
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Shell: The DevOps Tool for MySQL
MySQL Shell: The DevOps Tool for MySQL
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
Develop PHP Applications with MySQL X DevAPI
Develop PHP Applications with MySQL X DevAPI
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
MySQL Document Store
MySQL Document Store
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
Mysql NDB Cluster's Asynchronous Parallel Design for High Performance
Mysql NDB Cluster's Asynchronous Parallel Design for High Performance
What's New in MySQL 8.0 @ HKOSC 2017
What's New in MySQL 8.0 @ HKOSC 2017
Solution Use Case Demo: The Power of Relationships in Your Big Data
Solution Use Case Demo: The Power of Relationships in Your Big Data
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
Novinky v Oracle Database 18c
Novinky v Oracle Database 18c
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018
Recently uploaded
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
Sujith Sukumaran
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
kzayra69
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
Christoph Pohl
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Neo4j
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
Hr365.us smith
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
umasea
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
Livetecs LLC
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
Dinusha Kumarasiri
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
Hanief Utama
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
Philip Schwarz
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Velvetech LLC
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
Łukasz Chruściel
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Christina Lin
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
FerryKemperman
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
VICTOR MAESTRE RAMIREZ
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
OPEN KNOWLEDGE GmbH
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
jennyeacort
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
VICTOR MAESTRE RAMIREZ
Recently uploaded
(20)
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
MySQL Connector/Node.js and the X DevAPI
1.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | MySQL Connector/Node.js and the X DevAPI Rui Quelhas Software Developer Oracle, MySQL October 25, 2018 Presented with
2.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement 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. 2
3.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | 3 • Rui Quelhas • MySQL Middleware and Clients team (Connectors) • Connector/Node.js Lead Developer • rui.quelhas@oracle.com • @ruiquelhas whoami
4.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Outline Building blocks for modern MySQL Diving into the X DevAPI X DevAPI via Connector/Node.js Final thoughts 1 2 3 4 4
5.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Building blocks for modern MySQL 5
6.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | X DevAPI • High-level database API to develop modern applications powered by InnoDB Cluster • Application gateway for the underlying document-store infrastructure (X Protocol, Router, X Plugin) • Off-the-shelf support for CRUD NoSQL document operations • Lower-level management via raw SQL and other advanced features • Standard specification for all the official client implementations • Available in connectors for the most popular languages as well as the brand new MySQL Shell
7.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | MySQL Document Store • It’s now possible to save and retrieve unstructured data using a MySQL database (not talking about raw JSON) • Data lives in a JSON column but everything is abstracted way from the user, which only deals with documents • No need to worry about schemas and data types • Keeping logical consistency and ACID (it’s MySQL after all) • At the same time, a schema can still mix in traditional tables • ...and more https://lefred.be/content/top-10-reasons-for-nosql-with- mysql/
8.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Component Overview Client App MySQL Router X DevAPI X Plugin X Protocol https://dev.mysql.com/doc/refman/8.0/en/document-store.html Classic Protocol
9.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Router • MySQL Router is an integral part of InnoDB Cluster • Lightweight middleware that provides transparent routing between an application and back-end MySQL servers • Can be used for a wide variety of use cases, but mainly to address high availability and scalability concerns • Runs as a standalone component • Packaged with the MySQL server for the usual platforms • Documentation available at https://dev.mysql.com/doc/mysql- router/8.0/en/
10.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | X Plugin • New MySQL server plugin (developed internally) • Installed and enabled by default on MySQL 8.0 series • Provides the document store infrastructure on top of plain MySQL servers • Uses a different set of ports (33060 instead of the usual MySQL 3306) • Implements a client-server protocol based on Google Protocol Buffers • Accepts X DevAPI client requests and processes them using the core MySQL engine • Documentation available at https://dev.mysql.com/doc/refman/8.0/en/document-store.html
11.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | X Protocol • New client-server protocol based on Google Protocol Buffers (easier for ANYONE to extend and improve) • Content awereness – CRUD expression trees to establish operation boundaries – Expectations to define conditions and create pipelined statements – Placeholder assignment and value escaping • Security baked in – SSL/TLS by default – No information leaked to unauthenticated users (e.g. server version) • Open source at https://dev.mysql.com/doc/internals/en/x-protocol.html
12.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | X Protocol Message example Mysqlx.Crud.Find { collection { name: "collection_name", schema: "schema_name" } data_model: DOCUMENT criteria { type: OPERATOR operator { name: "==" param { type: IDENT, identifier { name: "_id" } } param { type: LITERAL, literal { type: V_STRING, v_string: { value: "some_string" } } } } } }
13.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Building upon the X Protocol • Each client offers a unified (up to some point) flavour of the X DevAPI to be consumed by an application • X DevAPI constructs are exposed to the user via contextual methods operating on different database objects through the hierarchy • Database interactions are encoded as X Protocol messages expressing the respective action • Level of abstraction varies depending on the task • Represents the vision of the MySQL team • However, anyone can create their own API flavour on top of the protocol 13
14.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Diving into the X DevAPI 14
15.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Overview • Wraps powerful concepts in a simple API – High-level session concept for writing code that transparently scales from single MySQL Server to a multi-server environment – Operations are simple, expressive and easy to understand – Non-blocking, asynchronous calls follow common host language patterns. • Introduces a new, modern and easy-to-learn way to work with data – Documents are stored in Collections and have their dedicated CRUD operation set – Work with your existing domain objects or generate code based on structure definitions for strictly typed languages – Focus is put on working with data via CRUD operations (even for regular tables) – Semantic query-building preferred over traditional SQL string mashing 15
16.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | What do I get? • Fluent API and flexible parameters • Multiple connection modes (with support for connection pooling) • Automatic connection failover and timeout management • Security best practices with multiple SSL/TLS operation modes and authentication mechanisms as well as improved SQL injection protection • Small and portable expression-based query language (subset of SQL) • Hybrid CRUD API for both Document store collections and regular tables • SQL statements for everything else • ACID (transactions and row locking) 16
17.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Fluent API • Code flows from a single point of entry – getSession() • Code becomes more readable, maintainable (and even testable) • Operations encapsulated in specialized and semantic methods • Nice scaffolding for refactor tasks • First-class support for text-editor (or IDE) hints and auto-completion • Smaller SQL injection surface area • Common standard between different programming environments 17
18.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Flexible Parameters • Most public API methods work with: – Multiple individual parameters – A single array of parameters – An object with named properties (where it applies) 18 mysqlx.getSession('root@localhost') mysqlx.getSession({ user: 'root' }) collection.add({ name: 'foo' }).add({ name: 'bar' }) collection.add([{ name: 'foo' }, { name: 'bar' }]) collection.find('name = :name').bind('name', 'foo') collection.find('name = :name').bind({ name: 'foo' }) collection.find().fields('foo', 'bar') collection.find().fields(['foo', 'bar'])
19.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Connection Types • Each X DevAPI Session matches a single connection (regular mode) • Pooling mode (X DevAPI Sessions create or re-use existing connections) 19 Different operation modes const url = 'mysqlx://root@localhost:33060/defaultSchema' // create a regular standalone connection mysqlx.getSession(url) const pooling = { enabled: true, maxIdleTime: 500, maxSize: 25, queueTimeout: 500 } const client = mysqlx.getClient(url, { pooling }) // acquire a connection from the pool (creates one if it does not exist) client.getSession()
20.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Connection failover and timeout • Automatic priority-based failover • Different timeout management for single-host or multi-host settings 20 Pooling and non pooling setups // single-host mysqlx.getSession('mysqlx://root@localhost:33060?connect-timeout=1000'); // multi-host // order-based priority mysqlx.getSession('mysqlx://root@[localhost:33060, localhost:33061]?connect-timeout=1000') mysqlx.getSession('root@[localhost:33060, localhost:33061] ') // weight-based priority mysqlx.getSession('mysqlx://root@[(localhost:33061, priority=99), (localhost:33060, priority=100)]') mysqlx.getSession('root@[(localhost:33061, priority=99), (localhost:33060, priority=100)]?connect-timeout=1000')
21.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Security Options • SSL/TLS is enabled by default, for TCP connections, when creating a session • Local UNIX socket connections disable it (not needed) to be faster • Additional server certificate validation • Options can be overridden on-demand 21 mysqlx.getSession({ ssl: false }) mysqlx.getSession('mysqlx://root@localhost?ssl-mode=DISABLED') mysqlx.getSession({ ssl: true, sslOptions: { ca: '/path/to/ca.pem' } }) mysqlx.getSession('mysqlx://root@localhost?ssl-ca=(/path/to/ca.pem)') mysqlx.getSession({ ssl: true, sslOptions: { ca: '/path/to/ca.pem', crl: '/path/to/crl.pem' } }) mysqlx.getSession('mysqlx://root@localhost?ssl-ca=(/path/to/ca.pem)&ssl-crl=(/path/to/crl.pem)')
22.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Authentication Mechanisms • SHA-1 and SHA-2 password hashing • Supports authentication mechanisms for multiple server plugins: – MYSQL41 for mysql_native_password – PLAIN and SHA256_MEMORY for sha256_password and/or caching_sha2_password 22 mysqlx.getSession({ user: 'root', auth: 'MYSQL41' }) mysqlx.getSession('mysqlx://root@localhost?auth=MYSQL41') mysqlx.getSession({ user: 'root', auth: 'PLAIN' }) mysqlx.getSession('mysqlx://root@localhost?auth=PLAIN') mysqlx.getSession({ user: 'root', auth: 'SHA256_MEMORY' }) mysqlx.getSession('mysqlx://root@localhost?auth=SHA256_MEMORY')
23.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Hybrid CRUD API • Operational methods return proper database object or operation instances • CRUD operations: CollectionAdd, TableInsert, CollectionFind, TableSelect, CollectionModify, TableUpdate, CollectionRemove, TableDelete • Operation boundaries - filtering criteria, computed projections, placeholder assignment, resultset ordering - established using an expression language Table Collection • insert() • select() • update() • delete() • add() • find() • modify() • remove() 23
24.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Expression Strings • Small subset of the SQL language • Easy to grasp (everyone already knows SQL) but still powerful • Expressive and human-readable • Common standard between all the official connector implementations // JavaScript collection .find("name = 'foo' AND age > 42") .fields("name", "age") .groupBy("name", "age") .sort("name ASC", "age DESC") .limit(4) .offset(2) .execute() // Java collection .find("name = 'foo' AND age > 42") .fields("name", "age") .groupBy("name", "age") .sort("name ASC", "age DESC") .limit(4) .offset(2) .execute()
25.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Placeholder assignment • Placeholders are supported by the expression grammar • Variable values are native to the protocol itself • Additional server-side validation and escaping • Mitigates SQL injection risks 25 collection.find('name = :name') .bind('name', 'foo') .execute() collection.find('name = :name') .bind({ name: 'foo' }) .execute() Mysqlx.Crud.Find { criteria { operator { param { identifier { document_path: "name" } } param { position: 0 } } } args { v_string: "foo" } }
26.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Raw SQL • For ETL, structured analytics and/or reporting, SQL is always an option • Allows to tap into features not yet part of the X DevAPI, such as: – DDL operations for relational tables – Managing key constraints – Using JOINs 26 // create a table session.sql('CREATE TABLE foo (bar VARCHAR(3))').execute() // add a unique constraint session.sql('ALTER TABLE foo ADD COLUMN bar VARCHAR(3) GENERATED ALWAYS AS doc->>"$.bar" VIRTUAL UNIQUE KEY NOT NULL').execute() // execute a JOIN query session.sql('SELECT DISTINCT t1.bar FROM foo t1 JOIN baz t2 ON t1.bar = t2.qux WHERE t1.qux = t2.quux').execute()
27.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Transactions and Savepoints • Session-level atomic operations • Create, commit or rollback transactions in the scope of a session • Create, release or rollback to intermediate savepoints in those transactions 27 try { session.startTransaction() // run some operations (1) session.createSavepoint('foo') // run more operations (2) session.releaseSavepoint('foo') session.commit() } catch (err) { try { session.rollbackTo('foo') // go to (2) } catch (err) { session.rollback() // revert the entire thing } }
28.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Row Locking • Reads determine isolation level in the presence of concurrent transactions • Exclusive and Shared locks with different operation modes: – DEFAULT (regular SELECT FOR ... UPDATE or SELECT FOR ... SHARE behavior) – NOWAIT (query executes immediately and fails if row is locked) – SKIP_LOCKED (query executes immediately and ignores row) 28 // works for table.select() as well collection.find('name = "foo"').lockExclusive() // mysqlx.LockContention.DEFAULT collection.find('name = "foo"').lockExclusive(mysqlx.LockContention.NOWAIT) collection.find('name = "foo"').lockExclusive(mysqlx.LockContention.SKIP_LOCKED) // works for table.select() as well collection.find('name = "bar"').lockShared() // mysqlx.LockContention.DEFAULT collection.find('name = "bar"').lockShared(mysqlx.LockContention.NOWAIT) collection.find('name = "bar"').lockShared(mysqlx.LockContention.SKIP_LOCKED)
29.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | X DevAPI via Connector/Node.js 29
30.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Overview • Currently the only Node.js driver for MySQL with out-of-the-box support for 8.0 servers and, particularly, the X DevAPI • Open source, available on GitHub and on npm • Modern Node.js asynchronous API using Promises • Covers a big chunk of the X DevAPI spec: – Fluent API and query builder based on the common expression language – Document store and relational CRUD methods alongside plain SQL support – Secure by default (SSL/TLS and SHA256 authentication) – Connection pooling and failover – Logical consistency with transactions, savepoints and row-locking... 30
31.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Asynchronous API • Operations are sent to the server when the execute() method is called – receives an optional query operation callback push-based cursor) which runs for each element in the result set – returns a Promise which resolves to a Result instance containing details and metadata about the operation, or fails with an Error (can be used with async/await) collection .remove() .execute(/* no cursor will be needed */) .then(result => { // result contains details about the operation }) .catch(err => { // handle any errors }) collection .find() .execute(doc => { // do something with the document }) .then(result => { // result contains details about the operation }) .catch(err => { // handle any errors })
32.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Up and running $ npm install --save --save-exact @mysql/xdevapi (async function () { const session = await mysqlx.getSession({ user: 'root' }); const schema = session.getSchema('devapitalks'); if (!(await schema.existsInDatabase())) { await session.createSchema('devapitalks'); } // ... })(); const mysqlx = require('@mysql/xdevapi');
33.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Data definition // const schema = session.getSchema('devapitalks'); await schema.createCollection('sessions_nosql', { ReuseExistingObject: true }); // For now, table DDL operations are performed using SQL only await session.sql('USE devapitalks').execute(); await session.sql(`CREATE TABLE sessions_sql ( _id VARCHAR(7) NOT NULL, title VARCHAR(250), PRIMARY KEY (_id) )`).execute(); const collections = await schema.getCollections(); console.log(collections); // [{ schema: 'devapitalks', collection: 'sessions_nosql' }] const tables = await schema.getTables(); console.log(tables); // [{ schema: 'devapitalks', table: 'sessions_sql' }]
34.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Saving data const table = schema.getTable('sessions_sql'); const collection = schema.getCollection('sessions_nosql'); // single insert await table.insert('_id', 'title').values('ODEV5985', 'This talk!').execute(); // batching inserts const batchA = collection .add({ _id: 'ODEV5986', title: 'Node.js and the MySQL Document Store', speakers: ['Rui Quelhas'] }) .add({ _id: 'ODEV6233', title: 'Connector/J Beyond JDBC...', speakers: ['Filipe Silva'] }); const batchB = table .insert(['_id', 'title']) .values(['ODEV5959', 'Python and the MySQL Document Store']); const batchC = table .insert('_id', 'title') .values('OHOL1706', 'Developing Modern Applications with the MySQL Document Store and Node.js'); await Promise.all([batchA.execute(), batchB.execute(), batchC.execute()]);
35.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Retrieving data // const collection = schema.getCollection('sessions_nosql'); await collection.find('title LIKE :pattern') .bind({ pattern: '%Node.js%' }) .fields('_id', 'speakers') .execute(console.log); // { _id: 'ODEV5985', speakers: ['Rui Quelhas'] } // const table = schema.getTable('sessions_sql'); await table.select() // project specific columns if needed .where('title LIKE :pattern') .bind('pattern', '%MySQL%') .orderBy('_id ASC') .limit(1) .offset(1) .execute(console.log); // ['OHOL1706', 'Developing Modern Applications with...']
36.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Updating data // const collection = schema.getCollection('sessions_nosql'); await collection.modify('_id = :id') .bind('id', 'ODEV5986') .set('title', 'The talk about Document Store!') .execute(); const doc = await collection.getOne('ODEV5986'); console.log(doc); // { _id: 'ODEV5986', title: 'The talk about Document Store!', speakers: ['Rui Quelhas] } // const table = schema.getTable('sessions_sql'); await table.update() .where('_id = :id') .bind({ id: 'ODEV5985' }) .set('title', 'MySQL Connector/Node.js and the X DevAPI') .execute(console.log); await table.select() .where('_id = :id') .bind('id', 'ODEV5985') .execute(console.log) // ['ODEV5985', 'MySQL Connector/Node.js and the X DevAPI']
37.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Deleting data // const collection = schema.getCollection('sessions_nosql'); await collection.remove('true').execute(); const docs = []; const doc = await collection.find().execute(doc => docs.push(doc)); console.log(docs); // [] // const table = schema.getTable('sessions_sql'); await table.delete() .where('title LIKE :pattern') .bind('pattern', '%Node.js%') .execute(); await table.select() .execute(console.log) // ['ODEV5959', 'Python and the MySQL Document Store']
38.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Final thoughts 38
39.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Some takeaways • Simplify and secure your database installation • Reap the benefits of both SQL and NoSQL • High-availability and scalability via InnoDB Cluster • Fast prototyping but always with maintainability in mind • No language or platform lock-in (portable API constructs) • Stick to a modern simple Node.js workflow (async, npm) • Deploy everywhere where Node.js excells (containers, microservices, serverless and FaaS, desktop, IoT, etc.) • It’s all open source
40.
Copyright © 2018,
Oracle and/or its affiliates. All rights reserved. | Links and Resources • https://dev.mysql.com/doc/x-devapi-userguide/en/ • https://github.com/mysql/mysql-connector-nodejs • https://www.npmjs.com/package/@mysql/xdevapi • https://dev.mysql.com/doc/dev/connector-nodejs/8.0/ • https://www.mysql.com/news-and-events/web-seminars/mysql- document-store-and-node-js/ • https://www.mysql.com/news-and-events/web-seminars/mysql- document-store-and-node-js/ 40
Download now