In MySQL Shell, you can create new collections, get a list of the existing collections in a schema, and remove an existing collection from a schema. Collection names are case-sensitive and each collection name must be unique.
To show the value that is assigned to the schema variable,
If the schema value is not
then set the
db variable as follows:
\use world_xSchema `world_x` accessible through db.
To create a new collection in an existing schema, use the
The following example creates in the
world_x database a collection called flags.
The method returns a collection object.
To display all collections in the
database, use the
on the schema object. Collections returned by the server
appear between brackets.
db.getCollections()[ <Collection:countryinfo>, <Collection:flags> ]
To drop an existing collection from a database, use the
dropCollection() method on the session
object. For example, to drop the flags collection from the
world_x database, type:
session.dropCollection("world_x", "flags")Query OK (0.04 sec)
See Collection Objects for more examples.