Database

Inserting a row is a very fundamental action in databases. MongoDB makes it very easy.

First you need to be in your database

> use your_database_name
switched to db your_database_name

Insert your record using the insert method on your collection

> db.books.insert({
  title: 'Book Title',
  category: 'Fiction',
  tags: ['children', 'fantasy'],
  user: {
    name: 'Sophia',
    status: 'author'
  },
  date: Date()
})
WriteResult({ "nInserted" : 1 })

Show your rows

> db.books.find()
{ "_id" : ObjectId("5d5e1c357545de885fa391fb"), "title" : "Book Title", "category" : "Fiction", "tags" : [ "children", "fantasy" ], "user" : { "name" : "Sophia", "status" : "author" }, "date" : "Thu Aug 22 2018 12:38:12 GMT+0800 (PST)" }

Awesome!