Add output on mongodb OUT node to provide status (success/fail)

#1

Hi,

I think the OUT node for node-red-node-mongodb (which is provided with the extra nodes package) should provide an output, so we can process the status of the query (Did it fail ? Did it succeed ? When ?)

Simple real case : I'm exposing an HTTP endpoint updating a document in a mongo DB. As of right now, I have no means to send the HTTP response WHEN the query is done, or to provide details on the success of the query in the HTTP response. My only option is to send a HTTP 200 when the HTTP endpoint is called, meaning I cannot send an error response when/if the node fails.

I'm willing to implement this, but I was suggested to post here before making a pull request.

Have a good day

0 Likes

MongoDB node improvements
#2

Hi,

thanks for raising the thought. Haven't looked at that node for a while. The normal way we would handle this would be for the node.status or node.error to be set appropriately so it can then be caught by the status or catch nodes. Having not looked at this node for a while it may well not do this...

In general we would prefer this than adding an output.

0 Likes

#3

Hi,

Thanks for your answer.

I understand that it may be more elegant/fitting to use the status property instead of adding an output.

That raises me another question, the answer might be obvious but i'm not seeing it : How can I keep the msg.res and http related properties to send with the response ?

I know i can send a whole object with the node.error function, but the node status only allows fill, shape and text properties (I tried to add some extra property, but it was lost on the output of the status node).

0 Likes