## Related Information 

## 20.4.3.1 Create, List, and Drop Collections 

•See Working with Collections for a general overview. 

•CRUD EBNF Definitions provides a complete list of operations. 

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. 

## Confirm the Schema 

To show the value that is assigned to the schema variable, issue: 

mysql-py> db 

If the schema value is not Schema:world_x , then set the db  variable by issuing: 

## Create a Collection 

mysql-py> \use world_x 

To create a new collection in an existing schema, use the db  object’s createCollection()  method. The following example creates a collection called flags  in the world_x  schema. 

## List Collections 

mysql-py> db.create_collection("flags") 

The method returns a collection object. 

<Collection:flags> 

To display all collections in the world_x  schema, use the db  object’s get_collections()  method. Collections returned by the server you are currently connected to appear between brackets. 

## Drop a Collection 

mysql-py> db.get_collections() [ <Collection:countryinfo>, <Collection:flags> ] 

To drop an existing collection from a schema, use the db  object’s drop_collection()  method. For example, to drop the flags  collection from the current schema, issue: 

mysql-py> db.drop_collection("flags") 

The drop_collection()  method is also used in MySQL Shell to drop a relational table from a schema. 

## Related Information 

## 20.4.3.2 Working with Collections 

•See Collection Objects for more examples. 

