Skip to content

Dry Run Architecture 📄

Divyanshu Rawat edited this page May 24, 2020 · 4 revisions

Non-relational DB (MongoDB) v/s Relational (SQL). Here we are basically trying to figure out relying on MongoDB is a good decision or not? We will compare MongoDB, Mysql, Postgresql.

Our MongoDB Architecture.

User Model

{
    "_id": {
        "$oid": "5e6c19307dfa310017bd0344"
    },
    "username": null,
    "firstName": null,
    "lastName": null,
    "profileAvatar": null,
    "oAuth" :{
     "linkedIn": {
        "profileUrl": null,
        "accessToken": null
     },
     "google": {
        "profileUrl": null,
        "accessToken": null
     },
    },
    "socialProfiles" :{
     "linkedIn": null,
     "google": null,
     "facebook": null,
     "github": null,
     "twitter": null,
     "website": null,
     "blogs": null,
     "researchGate": null,
    },
    "location": {
      "country": null,
      "city": null,
      "province": null,
    },
    "followers" : [
     {"username" : "john"}, 
     {"username" : "max"}, 
     ....
    ],
    "following" : [
     {"username" : "john"}, 
     {"username" : "max"}, 
     ....
    ],
    "about": null,
    "shortHeadline": null,
    "recommendations":{
      received: [
        {
          by: { type: String },
          content: { type: String },
          date: null
        }
      ],
      given: [
        {
          to: { type: String },
          content: { type: String },
          date: null
        }
      ]
    },
    "researchArea": [],
    "experience": [],
    "publications": [
    {
      name: null,
      startDate: null,
      endDate: null,
      description: null,
      tags: [],
      link: null,
    }, ...],
    "education": [{
     "school": null,
     "degree": null,
     "fieldOfStudy": null,
     "startDate": null,
     "endDate": null,
     "grade": null,
     "description": null,
     "media": null,
    }, ...],
    "verifyToken": null,
    "isUserVerified": 0,
    "admin": false,
    "resetPasswordToken": null,
    "resetPasswordExpiration": null,
    "email": "[email protected]",
    "password": "****",
    "userType": "student",

    "__v": 0
}

Student Model

{
    "_id": {
        "$oid": "5e6c19307dfa310017bd0345"
    },
    "curriculumVitae": null,
    "savedOpportunity": [{ id: 1 }, { id: 2 }],
    "__v": 0
}

Professor Model

{
    "_id": {
        "$oid": "5e98bc27e02bff55714de80f"
    },
    "__v": 0
}

Opportunity Model

{
    "_id": {
        "$oid": "5e9756773df8df0017c34ba3"
    },
    title: null,
    "applicants" : [
     ids of student, ...
    ],
    offeredBy: null,
    decription: { type: String, required: true },
    summary: { type: String, required: true },
    location: null,
    opportunityType: null,
    researchFields: null,
    stipend: null,
    datePosted: null,
    

    "__v": 0
}

Post Model

{
    "_id": {
        "$oid": "5e9756773df8df0017c34ba3"
    },
    likes: [{ type: ObjectId, ref: "User" }],
    "__v": 0
}

Clone this wiki locally