Skip to content

Isn't it an overkill to create both followers and followings schema?. #13

Description

@aseerkt

Can't we just keep track of followers and followings from a single schema?.

insta-clone-follow

For example, combining both of them into Follow.js like shown below.

// Follow.js
const FollowSchema = new Schema({
  follower: {
    type: Schema.ObjectId,
    ref: 'User'
  },
  following: {
    user: {
      type: Schema.ObjectId,
      ref: 'User'
    }
 },
});

I am noob btw when it comes to DB design, especially with NoSQL.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions