MongoDB find query ISODate support

Describe the problem/error/question

Using ISODate in a find() query gives errors.

What is the error message (if any)?

SyntaxError: Expected property name or ‘}’ in JSON at position 2 at JSON.parse () at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MongoDb/MongoDb.node.js:137:49) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:664:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1076:20

Share the output returned by the last node

Information on your n8n setup

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Glenn_B

Thanks for posting here and welcome to the community! :partying_face:

I’m not an expert on Mongo DB, but I believe you will have to put the keys in strings, like so:

{ "updated": { "$lt": ISODate("2021-02-25T10:03:46.000Z") } }

You can also have a look at a similar post from the community:

Let me know if this helps! :raised_hands:

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