mercredi 2 août 2017

how to segregate user data in mongodb or cassandra

I am making my first ever web app and I am totally confused about how to separate data of different users.

The app will have multiple users. Users will have their own data (somewhere in the cloud, say Heroku). How will I segregate data of different users in the db (say mongodb or cassandra)?

My thoughts are: 1) I know that each user will have a unique email id. Shall I use this as the primary key of the database and segregate data based on this key?

2) I am pretty confident this one is wrong! Will I create a new instance of the db (and respective documents (tables)) when new user registers (thereby creating a compartment in which only that user's data will be stored). The username/password of the database will be same as username/password of the user's (used for web login) 1.1) How will I create such db instance programmatically (I know how to use a cli but don't know how to do so using a web backend process) 1.2) How will I have to maintain some mapping between a user and their database instance ?

Aucun commentaire:

Enregistrer un commentaire