db.users.insertOne({name: 'Alice'})

Category: Databases & SQL

db.users.insertOne({name: 'Alice'})

Insert a single document

Adds one document to the users collection; MongoDB generates an _id field when you do not supply one. insertMany([{...}, {...}]) inserts several in one round trip. Related: updateOne, deleteOne.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.