These are chat archives for Automattic/mongoose

24th
Jun 2018
panigrah
@panigrah
Jun 24 2018 02:29
Looking for schema ideas to manage SAas subscription for the app I am developing. Stripe is backend - but fetching subscription and plan details from stripe is slow, need to cache locally or other mechanism. Don’t want to reinvent wheel as it should be a common challenge and hoping somebody is able to share what they did
Kev
@lineus
Jun 24 2018 09:36
@v0idifier_twitter you can add a post-hook to the schema for the model that the ref is pointing to that finds and removes references to the deleted documents in the collection with the arrays of refs middleware docs.
godlatro
@godlatro
Jun 24 2018 17:35
Hi!
Someone know where can I find CRUD API patterns or best way to create it?
vøid a.k.a. Machito Opresor
@v0idifier_twitter
Jun 24 2018 19:02
hmm @lineus
that would work
but I'm using Model.remove, that is not supported
Kev
@lineus
Jun 24 2018 19:14
@v0idifier_twitter that's true. You could write a static on the Model instead that fires off the Model.remove() and also calls the update command on the docs with the ref.
Kev
@lineus
Jun 24 2018 19:21
@v0idifier_twitter something like this
vøid a.k.a. Machito Opresor
@v0idifier_twitter
Jun 24 2018 19:39
@lineus Thanks!
Kev
@lineus
Jun 24 2018 19:56
anytime :)
Kev
@lineus
Jun 24 2018 20:32
@godlatro I'm not sure I understand what you mean. Can you elaborate a bit on what you're looking for?