These are chat archives for Automattic/mongoose

May 2017
Julio Borja Barra
May 26 2017 10:57
hey guys. I'm saving the settings for a user in my application. This is really easy to do in the same document (user) and semantically makes sense totally.
The problem is, when I want to send a notification I have to instantiate the user to get it's settings (if she wants or not to be notified) which is not a problem when addressing directly to her. BUT when I'm broadcasting it would be madness to instantiate ALL the users, so I was thinking in storing this config in another structure with the IDs of the users that want to be notified.
This brings us to the sync problem and bye bye single source of truth.
What is the best way to maintain these two structures in sync? Maybe through a middleware in both documents (user and the other weird list of users that want the notifications)?
May 26 2017 18:27
hey guys
if you need typescript classes from your mongoose models i wrote a little library :)