So I created the following workflow which creates this document and then queries it directly. which worked fine for me. Can you please check if that is also the case for you.
Hi again!
I dont know if should create a new topic of it is fine to ask it here.
Everything with the look up is working fine but still my plan failed. I have talked with our devs aswell but could not find a solution.
I would like to store a mapping to an item in previous node inside in the json file (in mongo) Set pictures below. The stored mapping should then be used to get the data from a previous node. I know it might be a bit strange explanation but i hope the pictures explains it better.
So if I understand it correctly do you have an n8n expression saved in your database and you want to then evaluate it after you read if from there? If that is the case, then it is currently sadly not possible. We would have to create and expose an additional function to do that. I added it to the To-Do list.
We tried it out but it is not really solve thing problem yet
We would like following
//This evaluation is working
//"shipId" : "{{$node['Webhook'].json['body']['Location']['GlobalId']}}",
items[0].json.string3a = evaluateExpression($node["MongoDB"].json["event"]["location"]["shipId"], 0);
-------------
But we would need
// We would like to evaluate the whole json. Json will include the expression as value of some properties
items[0].json.string3a = evaluateExpression($node["MongoDB"].json, 0);
return items;
Ah yes, that would not work. Giving the whole objects is something very unique and a custom need and so should probably not be in n8n itself. At least do not expect that a lot of people would need that.
But that is not a problem. With the evaluateExpression function you can now solve that yourself. You can simply write your own custom code in a Function-Node which recursively goes through all the properties and then resolve the ones which, for example, start with “{”.
But when we place it with the real mongo DB then we get below error. The strange thing is when i then push only execute the failed node again then it works, but never on the first run.
ERROR: ‘getOwnPropertyDescriptor’ on proxy: trap reported non-configurability for property ‘0’ which is either non-existent or configurable in the proxy target
TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property '0' which is either non-existent or configurable in the proxy target
at Function.keys (<anonymous>)
at resolveData (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:5:30)
at resolveData (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:6:25)
at resolveData (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:6:25)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:20:11
at Object.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:24:2)
at NodeVM.run (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/main.js:1043:29)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function.node.js:67:31)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:557:37)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:370:62
The only thing I can think of right now is that the ID makes problems. The ID of Mongo documents is its own type and at the first run it is probably of that special type (and makes problems) and on the second run it got already converted to JSON and therefore it works.
You could try this node. It skips the “_id” property and makes instead sure that it gets directly converted to a “proper” string.