if I do mongoose.connect('whatever/email(as DB name)'), it throws errors. Is there any way to do it? I want to make a separate DB for each email.
if I do mongoose.connect('whatever/email(as DB name)'), it throws errors. Is there any way to do it? I want to make a separate DB for each email.
You can do as below.
Have a users meta collection
{
email:"a@action.com",
uniqueId: 12
}
Use this uniqueId as collection name to store details.
But this would require two calls every time - one to find user collection and another one on querying the respective collection.