handle auth by cognito user using nodejs + mongo, should i create a mongoose model?

Viewed 113

i am new to backend and thinking of using aws Cognito for auth and i am using express and mongoose in backend, my question is, do i have to create a mongoose model for user?

const userSchema = new mongoose.Schema(
  {
    email: {
      type: String,
      required: true
    },
    address: {
      type: String,
      required: false
    },
    fullName: {
      type: String,
      required: false
    },
    password: {
      type: String,
      required: true
    }
  }
)

i am seeing i can use aws cognito provider as admin in server side so do i need to keep newly signed up user to db if there are user records already on aws cognito? and thinking in server side what if cognito user has friends? i think it's necessary that i create a mongoose model but not sure if it's redundant

0 Answers
Related