Skip to content

5. Database Design

Albert Rando edited this page Apr 21, 2017 · 1 revision

Database Design

The database for this project is MongoDB. MongoDB is a noSQL database. Unlike the typical Relational Database, mongo is document storage database. Documents are stored in Collections and can contain sub-documents. Documents themselves do not have to share the same attributes making it very flexible and dynamic, allowing it to scale as your project scales and adapt it. Being it looser than RDBMS it puts some more strain on the developer itself to read from the database.


MongoDB is part of the MEAN stack framework. For this project is very useful because it can be changed along the project and adapt it to the different needs as they come, not having to redesign the database all over again.

The database for this project has been hosted on mLab.

In order to store the required data, three types of documents have been created in three different collections: User, Salon and Bookings.

User


The user collection will store users information.

  • username - Username of the user. Needed to login.
  • full_name - Full name of the user.
  • email - User's email.
  • password - User's password. Needed to authenticate user on login.
  • user_type - Whether the user is a consumer(user) or a salon(admin).
  • created_at - Date and time of user creation.

Salon


The salon collection will store information about the salon.

  • name - Salon's name.
  • location - Salon's Location.
  • services - Available services at the salon. (List)
  • description - Short description about the salon.
  • imgsrc - Image URL for the salon.
  • rating - Average rating of the salon. (0 by Default)
  • review - List of reviews from users along their ratings.
  • created_at - Date and time of user creation.

Bookings


The bookings collection will store the details about bookings.

  • username - User's username who requested the booking.
  • location - Location requested.
  • service - Service requested.
  • date - Booking's day to be taken place.
  • time - Time of the day of the booking.
  • timeMargin - Minutes of the time.
  • travelTime - Margin of time before request expires. (From date backwards)
  • status - Booking Status, it might be: 'new','pending','accepted','completed','reviewed','expired'.
  • candidates - List of salons available for booking.
  • selected - Salon selected out of candidates.
  • imgsrc - Image URL of booking location.
  • id - Booking id.
  • created_at - Date and time of booking creation.
Clone this wiki locally