I was wondering if it’s possible to write the fullDocument from a change stream to a file e.g. with the node fs module.
If not what could be an alternative?
I want to listen to the database for changes. And if changes are incoming and they matching a condition I want to work on other parts of my application with the data.
A document, is like any piece of data, what ever how you got it, can be written to a file.
You might need to use stringify to write is as a string.
Just go and try it and please share the code you came up with so that other users of the forum do not have to wonder if it is feasible or not.
In case you wonder further, you will be able to read back the string. You will probably need to parse to get back an object rather than just a string.