Mongo db query in nodered


I’m unable to query nested mongo db fields using function node of nodered since my knowledge of javascript is weak.

So I’m able to achieve this.

But I want to access just ‘msg’ key.

My ultimate goal is–
I want to show these 5 logs and after drill down in that, I want to show all ‘msg’.

Please help I’m stuck here.

Or is there anyway I can use python and achieve this

Funny you should ask. I’m currently working on a python SDK for openflow

But it only works with version openflow 1.5 that is still in beta
You can also install an NodeRED python node, to give you python syntax instead of JavaScript.
But no matter the language/syntax a mongodb query is still just a mongob query. ( and that is a json document )

Anyway, I simply do not understand what your code is trying to do … I cannot even guess what node you are sending it to. You have a sort field and projection, but that only works on Get node and you have an aggregrate but that only works with aggregate node. Maybe you could explain what it is your trying to achive and then maybe i can guide you in the correct direction ?