-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

The MySQL Workshop
By :

To do this, we use the worldcol
collection, which is a collection of JSON documents generated from the tables in the world
database. Unless otherwise specified, we will use MySQL Shell in JavaScript mode.
To create this collection, we need to first run the statements in the worldcol.js
file by writing the following query:
\connect —mx [email protected]:33060 \source worldcol.js
This outputs the following results:
Figure 13.25 – Output of sourcing worldcol.js
To explore, you first need to get a single document from the collection:
db.worldcol.find().limit(1)
This returns the first document of the worldcol
collection:
Figure 13.26 – The find() output with limit(1)
The find
function accepts an argument to filter rows:
db.worldcol.find('name="Paris"')
This returns the following results:
Figure 13.27 – The find(...