Grokking MongoDB
0% completed
Insert Operations
The users collection does not have to exist before you insert into it. MongoDB creates the collection the first time a document arrives, with no separate create step. The following commands start from a database with no collections at all.
If you are following along in a database that already has a users collection, run db.users.drop() first. This command removes the collection. Any other collections in your database will also appear in the list.
db.getCollectionNames() db.users.insertOne({ name: "Alice", age: 25, email: "alice@example.com" }) db.getCollectionNames()
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%