Retrieving certain data from a MongoDB

ok .. so this explains why you dont get a result now .. i was going to recommend to review the way you save the data in mongo because from your previous screenshot it seems that you were saving some unnecessary fields in each document (for example the data were nested under payload, saving topic, socketid, _msgid )

that can work but you could also use a Form ui_form node that gathers all the data and sends them with a Submit button.

Probably. It depends on how your data in mongodb looks like now after the changes you made
Can you show us a screenshot of a couple of records ? (documents in mongodb)

Okay, I have now inserted a ui_form node as you suggested (I have removed the individual text nodes and the join node)

However, I think the data is still stored in MongoDB in the same way: (The last one is made with the new ui_form node - just typing "5" in every field

Here is my current data acquisition flow. Starting with the now new Ui_Form Node, followd by a function "6" (In "function 6" I add a static addition to some values to bring them to a certain standard format): , after that uploading it with a mongoDB out node

1 Like

In the mongodb out node .. that saves the new document ..
do you have the option to save only the payload checked ?
image

Thanks for the comment, I had forgotten about that.

Thats my complete flow now:

I have emptied my MongoDB and imported two new documents.
image

However, the query still simply outputs all values (in this case now just the 2):
image

Much cleaner now with the db :+1:

Whats in your Function 7 now ?
it can be :

msg.payload = { "parentID": msg.payload }
// msg.projection = { "parentID" : 1 }
return msg;
1 Like

Nice!
Now it works with your code! Thanks!

(I will now make a few more adjustments.. i hope i can manage the rest on my own)

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.