Hello All,
We have an application where we have a remote edge device running Node-Red. Writing information to a MongoDB via the mongodb3in node. I don't know alot about databases and Mongo wasn't my choice, but the programming is working and we are successfully writing messages to the database.
The problem is that these machines are running on cellular. We have noticed significant data usage, much more than the messages we are sending. After a bunch of research and finally using wireshark, we realize the MongoDB3 node is constantly communicating with the database even when it is not receiving messages and using up a significant amount of data. If we disconnect the Mongo node and redeploy, the amount of traffic drops.
We would like it so that when the machine is not being used and no data is being written to the database, that our data usage is basically zero. So I expect this is not a node-red problem. And I am not sure where to start for help.
Does this sound like a misconfiguration of our node? (there isn't much configuration to it.)
Is it something just built into the node that we will not be able to avoid?
Is there some way to take the node offline until we need to use it?
Firstly, have you made absolutely sure there are no messages going to the mongo node when there should not be?
Check the mongodb server node log (I presume mongodb can generate access logs) and see what it is doing.
Is mongoDB running on the remote device or the local? Is it the remote device that is on the cellular network?
The node itself doesn't have a log, but if you start node-red in a terminal then you will see the node-red log. I don't expect there to be anything useful, but always worth checking. Sometimes issues like this can be side effects of another problem.
Another approach might be to run node-red in the cloud (or on a server somewhere) as well as in your devices, and send information to it from your devices using something like MQTT, and send it to the database from that node-red server.
You might need to contact the author of that node.
Unlike InfluxDB, MongoDB's REST API is query only. If all you want to to is get data from the DB then you could use that directly from Node-RED using the http-request node. But to write data, you need a client.
At a push you could possibly use a command line client and call it via the exec node. Not very elegant though.
Here it is. Please let us know if we are interpreting this wrong. We see this even with the node disconnected. We have to delete the node to get it to stop.