First StepThe new MySQL Shell is a separate install from the server software. Once installed it will provide the ability to use MySQL as a document store.
The db object is how we can communicate to the server and the world_x data. Now we can create a simple collection.
Whoa! Something is wrong, isn't it?
The Document Store adds an _id column automatically. You can specify your own _id but be warned it is defined by default as an UNIQUE index, so no duplicates. The InnoDB storage engine desires a index and will pick a column to index if you do not specify one (usually not a great choice in a column BTW). But JSON columns can not be directly indexed. But do not worry about the details but do note that the _id column is there.
Also notice the order of the data returned. The MySQL JSON data type organizes the data in a special binary format for faster look ups and the side effect is the alphabetizing of the keys in the key/value pairs.
FiltersFilters can be added to find specific records and to return just the desired information (default is like a SELECT *).
You can bin values to variables to separate the data from the condition.
Modify DataIf you are used to UPDATE set x=y WHERE z=n then the next part may look a little odd.
We can also add to or remove items for arrays within the data. The $ is short hand for the 'current document'.
And of course db.foobar.remove() would delete all the records in the collection.