node-red-nodes icon indicating copy to clipboard operation
node-red-nodes copied to clipboard

Cannot retrieve node-red-node-mongodb query status

Open mickev36 opened this issue 7 years ago • 3 comments

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 was suggested on the node-red forum to use the status node to catch status emitted from the mongo node, but with this method, I cannot keep the http related properties (msg.req, etc...) to send to the http out node (since you can only pass fill, shape and text properties with status, where you can send a whole object with node.error for example).

I'm willing to implement this if needed.

Have a good day

mickev36 avatar Sep 14 '18 08:09 mickev36

Hi, as mentioned in the template you deleted before raising this issue, we prefer feature requests to be raised and discussed on slack or the forum rather than in issues. We try and keep issues for actual code defects.

In this case look at the catch node which can be used to detect failures.

hardillb avatar Sep 14 '18 08:09 hardillb

Hello,

I've posted on the forum, but only had one answer which was the "status" proposal. It doesn't solve the problem, as I can't use this method to conserve http.req properties for the http out node. The thread starts to be buried, and I have no solution except for maintaining a fork, which sounds overkill.

The catch node also cannot be used : the mongo node doens't emit an error on a query success.

This is to me is an actual defect : there is no way as-is to use the mongo node for a HTTP endpoint, answering only when the query is done. I found no example on the web using this node (it looks like people are switching to mongodb2 which is not in the "official" extra node package).

mickev36 avatar Sep 14 '18 08:09 mickev36

Opened a PR on this issue : https://github.com/node-red/node-red-nodes/pull/517

I will close this issue once the PR is resolved

mickev36 avatar Feb 12 '19 15:02 mickev36