MongoDB Documentation, Release 3.0.4 SQL Schema Statements MongoDB Schema Statements CREATE TABLE users ( id MEDIUMINT NOT NULL AUTO_INCREMENT, user_id Varchar(30), age Number, status char(1), PRIMARY KEY (id) ) Implicitly created on first insert() operation. The primary key _id is automatically added if _id field is not specified. db.users.insert( { user_id: "abc123", age: 55, status: "A" } ) However, you can also explicitly create a collection: db.createCollection("users") ALTER TABLE users ADD join_date DATETIME Collections do not describe or enforce the structure of its documents; i.e. there is no structural alteration at the collection level. However, at the document level, update() operations can add fields to existing documents using the $set op- erator. db.users.update( { }, { $set: { join_date: new Date() } }, { multi: true } ) ALTER TABLE users DROP COLUMN join_date Collections do not describe or enforce the structure of its documents; i.e. there is no structural alteration at the collection level. However, at the document level, update() operations can remove fields from documents using the $unset operator. db.users.update( { }, { $unset: { join_date: "" } }, { multi: true } ) CREATE INDEX idx_user_id_asc ON users(user_id) db.users.createIndex( { user_id: 1 } ) CREATE INDEX idx_user_id_asc_age_desc ON users(user_id, age DESC ) db.users.createIndex( { user_id: 1, age: -1 } ) DROP TABLE users db.users.drop() For more information, see db.collection.insert() , db.createCollection() , db.collection.update() , $set , $unset , db.collection.createIndex() , indexes (page 486), db.collection.drop() , and Data Modeling Concepts (page 145). Insert The following table presents the various SQL statements related to inserting records into tables and the cor- responding MongoDB statements. 133 3.4. MongoDB CRUD Reference