Member-only story

#57 MongoDB (part 5): Build a MongoDB database from CSV file

Hang Nguyen
4 min readJun 21, 2022

--

Download data from here, orignally from Kaggle.

Data set analysis

Based on the given data set, 5 collections with its own purpose were created as follows:

  • Collection user: contains personal information of each user such as age, gender, native country, and race.
  • Collection education: contains information about user’s education such as education level and number of years of education.
  • Collection occupation: contains information of user’s work class, occupation, and hours of working per week.
  • Collection relationship: contains information of user’s marital status and relationship with owner.
  • Collection finance: contains information of user’s financial situation such as total income, income level, capital gain and capital loss.

ERD design

FIGURE 1. Database ERD design

Relationship among between collections:

- Users-Relationship: 1-M, meaning that many users have one same kind of relationship. One user has only 1 kind of relationship.

- Users-Finance: 1-M, meaning that many users have one same kind of financial situation. One user has only 1 financial state.

--

--

Hang Nguyen
Hang Nguyen

Written by Hang Nguyen

Just sharing (data) knowledge

No responses yet