mongodb - 4.8.1
nodejs - 16.16
mongoose - 6.5.1
express framework
I have a schema that works great for storing articles/blog posts.
Now I would like to find a way to intertwine each add/save/update to a txt file that contains the equivalent json structure that I’m saving in mongodb.
I know it may be crazy, but is it possible and which hook/hooks might it be best applied. I guess I’d like it to happen after the original save has tucked away the json into mongodb.
Also thinking of creating a separate model based on model-json-js to use as a separate model just for the file write part; when it saves, it’s writing to disk.
But first, maybe there’s a way to leverage the existing schema.
Any tips and advice appreciated.
Thanks,
Chris.