Store execution to mongodb


I’m trying to store the execution information to our Database (mongodb).

The execution data return by the API executions contains returns from MongoDB nodes including wild nested { createdAt : { $date …}} fields.
Since I’m trying to import the full Execution result into MongoDB again I’m getting the following error:

“ERROR: key $date must not start with ‘$’”.

I’m aware of the problem but not sure how to solve it with n8n. I tried to set the Date Field to: createAt without success. I wont be able to specify every nested createdAt field, since its quite dynamic.

Any idea?

Hey Eric,

I don’t really know a lot about MongoDB but if it is unhappy with the data does it not have an escape character you can use so maybe find each instance of $ and replace it with whatever Mongo needs to make it work?

Ok, i thought the mongo node can solve the problem.

I added a function node.

1 Like