Is it safe to store login credentials in MongoDB?

Viewed 17

I have a collection named "instructor"

the instructor collection's documents have fields like this

  ID:in 
  email:char 
  password:char
  name:int
  institution_id:array of int
  courses_id: array of int

I store all the login credentials of instructors and their courses in a single document. However, I am not sure if I should put id, email, password, and name in one collection, and institution_id and courses_id in another collection.

If I put all in one collection, it's simple and convenient. However, one concern I Have is that If I manipulated the institution_id and courses_id in the endpoint, I might accidentally do something to the email or password, and it will unintentionally modify the login credentials, the other concern is that if I keep on adding to array fields, the maximum 16Mb will be exceeded, but I am not sure if it will ever get near that limit.

Ideally, should I separate the data into two collections as in a relational database?

0 Answers
Related