I am learning nosql database design by developing a nodejs backend for a social network type application.
User schema in my backend is this:
userSchema = new mongoose.Schema({
name: {
type: String,
required: true
},
email: {
type: String,
required: true
},
hashed_password: {
type: String,
required: true
},
isVerified: {
type:Boolean,
default: false
},
emailVerificationToken: String,
emailVerificationTokenExpires: Date,
followers: [{ type: ObjectId, ref: 'User'}],
following: [{ type: ObjectId, ref: 'User'}],
pins: [{type: ObjectId, ref: 'Pin'}],
bio: String,
website: String
});
I am storing an array of references to followers which is an unbounded array. I know that the maximum document size is 16 MB. I want to develop a backend which must be scalable to handle millions of users. Should I have a separate schema to store followers, following data or the current database design is fine?