← All tutorials

GoCareerGo Tutorials

MongoDB Tutorial

Documents, collections, CRUD, aggregation, Atlas and driver connectivity.

insertOne()

Inserts a single new document into a collection, auto-generating an _id if one isn't provided.

db.users.insertOne({ name: 'Grace Hopper', role: 'Engineer' });