CREATE TABLE Statements
To create new MongoDB entities, use CREATE TABLE statements:
CREATE TABLE Syntax
The CREATE TABLE statement specifies the table name and a comma-separated list of column names and the primary keys of the table.
CREATE TABLE <table_name> IF [ NOT EXISTS ]
(
{
<column_name> <data_type>
[ NOT NULL ]
[ DEFAULT <literal> ]
[ PRIMARY KEY ]
[ UNIQUE ]
} | PRIMARY KEY ( <column_name> [ , ... ] )
[ , ... ]
)
Example Query:
The following statement creates a MyCustomers table on the MongoDB server with name, age, and address columns.
CREATE TABLE IF NOT EXISTS "MyCustomers" (name VARCHAR(20), age INT, address VARCHAR(20))