I am trying to store user preference for notifications.
One way to do is store types of notification in separate collection and store UUID of that notification type in user table.
e.g. notification-type
{
UUID: 'a81ef539-290b-4f28-b364-548970307a66'
name: 'newuser',
title: 'new user joined your project.'
}
and then in user collection I store it as following.
user
{
UUID: '26abfe2b-5da6-4bf2-9419-bb4336173b5a'
name: 'user1',
notification-preference: ['a81ef539-290b-4f28-b364-548970307a66']
}
Or alternatively I store directly name of notification type as following and I don't take UUID at all in notification-type collection. This approach requires change in future if I have to change the name though.
{
UUID: '26abfe2b-5da6-4bf2-9419-bb4336173b5a'
name: 'user1',
notification-preference: ['newuser']
}
What is better way to do this?