Hi guys, I am strougling with AI agent and Mongo DB component, I want to insert the data from my google sheet component into database also, but seems I am doing something wrong, I pasted the instruction from my AI agent and the output in MongoDB component but I am getting a wrong format into database, do you know a way to generate a VALIDA JSON for my mongo db? here the screenshots
Hi, Can you share whole mongodb node of n8n and json of mongodb node.
This is the LLM description:
Get last row from Google Sheet component and generate a valid JSON format to insert into mongo db, consider these keys:
Phone Number,
Store,
Category,
Address,
Expense Description,
Expense Amount,
Registered Date
This is my JSON format I want to generate to insert into Mongo db:
{
“Phone Number”: “1111111”,
“Expense Date”: “2025-12-12”,
“Store”: “mcdonald”,
“Category”: “food”,
“Address”: “aa 221 north”,
“Expense Description”: “my stuffs”,
“Expense Amount”: “212.6”,
“Registered Date”: “441234123”
}
Currently, you are facing an error because the LLM is not providing a valid output.
Change the prompt and try this one.
{
“Phone Number”: “{{ $fromAI(‘phone_number’, `This is the phone number`, ‘string’) }}”,
“Expense Date”: “{{ $fromAI(‘expense_date’, `This is the expense date`, ‘string’) }}”,
“Store”: “{{ $fromAI(‘store’, `This is the store`, ‘string’) }}”,
“Category”: “{{ $fromAI(‘category’, `This is the category`, ‘string’) }}”,
“Address”: “{{ $fromAI(‘address’, `This is the address`, ‘string’) }}”,
“Expense Description”: “{{ $fromAI(‘expense_desc’, `This is the expense desc`, ‘string’) }}”,
“Expense Amount”: “{{ $fromAI(‘expense_amount’, `This is the expense amount`, ‘string’) }}”,
“Registered Date”: “{{ $fromAI(‘registered_date’, `This is the registered date`, ‘string’) }}”,
}
Hey @eliascanaza !
I think you have to switch from “Tool Description “ to manually and enter like this :
Insert an object in database. Send with the different json just with the values of the
{{ $fromAI(‘full_name’, `Name of the customer`, ‘string’) }},
{{ $fromAI(‘contact’, `Customer’s contact`, ‘string’) }},
{{ $fromAI(‘description’, `Appointment description`, ‘string’) }},
{{ $fromAI(‘start_appointment_time’, `Start time of the appointment (ISO datetime)`, ‘string’) }},
{{ $fromAI(‘end_appointment_time’, `End time of the appointment (ISO datetime)`, ‘string’) }}
The last parameter doesn’t have comma , 'sign.
Better check this post , is quite the same “issue”.
Hope this helps!
Cheers!
You are doing it WRONG… check the post I shared, or at last how I said to put the parameters in description. As far I can see you put : “
Phone Number”: “{{ $fromAI(‘phone_number’, `This is the phone number`, ‘string’) }}”,
Instead do:
Insert an object in database. Send with the different json just with the values of the
{{ $fromAI(‘phone_number’, `phone number customer`, ‘string’) }},
ETC…





