How to remove " " from JSON structure for ISODate in MongoDB

Describe the issue/error/question

I’m trying to save ISODates into a MongoDB using the n8n MongoDB node. I can’t work out how to remove the “” around the new ISODate command

Mongo Doco (https://www.mongodb.com/docs/manual/reference/method/Date/)

n8n Execution screenshot (note the " around the value)
image

Please share the workflow

Share the output returned by the last node

ACTUAL OUTPUT

[{
    "todoist_task_id":6284114728,
    "todoist_task_ts":"2022-10-22T09:17:17.522110Z",
    "integ_id":"36cip7v7n86qkd33u7eulmd5mc",
    "integ_source":"google_calendar",
    "integ_ts":"new ISODate("2022-10-23T19:30:00+10:00")",
    "_id":"6353b51d027d670987253e38",
    "id":"6353b51d027d670987253e38"
}]

EXPECTED OUTPUT

[{    
    "todoist_task_id":6284114728,  
    "todoist_task_ts":"2022-10-22T09:17:17.522110Z",
    "integ_id":"36cip7v7n86qkd33u7eulmd5mc",
    "integ_source":"google_calendar",
    "integ_ts":new ISODate("2022-10-23T19:30:00+10:00"),
    "_id":"6353b51d027d670987253e38",
    "id":"6353b51d027d670987253e38"
}]

Information on your n8n setup

  • n8n version: 0.199.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Matt_W, you’d need to specify which fields are data fields when inserting date values. n8n should then handle them as expected.

For example like so:

In this example, I’ve specified which field is to be treated as a date field:

Let me know if you run into any trouble with this.

1 Like

Hi @MutedJam ,

Thanks for the response, I didn’t realise there was a ‘date field’ option. I will have a play and follow up if I have issues.

Kind regards

Matt