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:
mysql-py> \use world_x
To create a new collection in an existing schema, use the
create_collection() method. 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.
mysql-py> db.get_collections() [ <Collection:countryinfo>, <Collection:flags> ]
To drop an existing collection from a database, use the
drop_collection() method on the session
object. For example, to drop the flags collection from the
world_x database, type:
mysql-py> session.drop_collection("world_x", "flags") Query OK (0.04 sec)
See Collection Objects for more examples.