MongoDB node improvements


Hello everyone,

I've posted about an issue on the mongo node ( Add output on mongodb OUT node to provide status (success/fail) ) provided in the extra nodes.

Basically, the mongo-out doesn't have a way to retrieve when and if an operation is done. A workaround is to use the status emitted by the node, but this cannot be used in conjunction with the http in/out nodes for example (as the msg.req, msg.res... properties are lost).

I've forked the node to add another output, among another improvements. ( knolleary suggested that I implement those changes in the "official" mongo node.

Here's what I would change :

  • Merge the two nodes (mongo-in and mongo-out) so that every action has an output emitted when the action is done, with the query result (node emits the mongo response object).

  • Emit a result when any operation is done (status only or result)

  • I've also removed the "store whole msg instead of payload only" option for the save/insert actions, I think it's bad practice, I might be wrong ?

  • Not implemented yed, but I would like to make the node try to convert the _id property to ObjectID, as is annoying to do in a function node beforehand every time.

It's a pretty big breaking change (me might not want to merge the two nodes so it stays retro-compatible), so feel free to leave any additions/suggestions/remarks/comments :slight_smile:


Overall sounds good. Though I've not used MongoDB for a while - not since I found that it couldn't cope with large datasets on the original Pi and would regularly corrupt the db long before it reached anywhere near the db size it should have been able to reach.

I suspect that is a bit too much of a breaking option and doesn't seem to have any real benefit. If anyone has ever used that feature, you are blocking them from updating without rework.

That would need to be optional I think.


Makes sense, you're right.

Also a good suggestion.


Is there any other suggestions/remarks ? Should I put up the PR ? :slight_smile: