I am writing a plugin.
Can anybody pl. write the code pattern for this requirement of mine...
When a logged in user enters some data, the backend should do the following in response:
The user sends the data to the NodeBB backend in the following format:
{ key1: data-value1, key2: data-value2, ... }
Get the user id of the user and check if the key1, key2, etc. already exists in the Mongo DB (the user's collection/document)
If yes, overwrite the data
If not, store the data
Tell the client that the action has been taken
Actually, it is quite simple if you're writing an app from the scratch. What I am looking for is the pattern/way the NodeBB is currently handling this scenario and I want to code using the same pattern.
Thanks