We will, of course, need a datastore for our create, read, update, and delete functionality, so let's return to MongoDB in order to store these documents. You can refer back to Chapter 18, Node.js and MongoDB, if you need to refresh your memory on getting set up.
To get started with setting up a database from scratch, it helps to think of the database structure that you intend to use. While MongoDB doesn't require a schema, it's still a good idea to plan your MongoDB documents so that you're not being arbitrary with functionality or naming between sections.
Here's an idea of what each collection might look like:
settings: {
user
firstname
lastname
username
password
title
URL
media directory
}
entry: {
title
location
date
month
day
year
body
}
location: {
city
region
country
latitude
longitude
entries
}
It's good to keep your database simple, but remember that you can always expand on...