MySQL Document Store

by Lucas Vogel

MySQL Document Store is an Enterprise feature of MySQL 8 that gives you document store collections of JSON documents up to 1GB in size in the same database as your relational data.


MySQL Document Store is a feature available to MySQL Enterprise customers that allows you to store JSON documents in the same database as your relational tables. Document Store runs under the InnoDB storage engine, giving your NoSQL data the same performance, security, backup and replication benefits as your other data.

MySQL Document Store can handle JSON documents up to 1GB in file size. This offers much more storage capabilities than the current offerings provided by Azure CosmosDB (2MB) or Google Datastore (1MiB) or even AWS DocumentDB (16MB).

Document Store Interfaces

The Document Store feature is enabled using the following components:

  • The MySQL X Plugin which enables the X DevAPI; MySQL Shell and all of the connectors have functionality built in to act as a client to the document server.
  • The X Protocol is a client protocol built on top of the Protobuf industry standard.
  • The X DevAPI is a new and modern way of working with your document data within MySQL.

Your code will look something like this:

/ Connecting to MySQL Server and working with a Collection

// Connect to server
var mySession = MySQLX.GetSession("server=localhost;port=33060;user=user;password=password;");

var myDb = mySession.GetSchema("test");

// Create a new collection "my_collection"
var myColl = myDb.CreateCollection("my_collection");

// Insert documents
myColl.Add(new { name = "Sakila", age = 15}).Execute();
myColl.Add(new { name = "Susanne", age = 24}).Execute();
myColl.Add(new { name = "User", age = 39}).Execute();

// Find a document
var docs = myColl.Find("name like :param1 AND age < :param2").Limit(1)
.Bind("param1", "S%").Bind("param2", 20).Execute();

// Print document
Console.WriteLine(docs.FetchOne());

// Drop the collection
myDb.DropCollection("my_collection");

#For More Information

MySQL Document Store


Contact us today for more information on how to save money in the cloud with MySQL 8.0 Enterprise and MySQL Document Store.