When running the script: db.evento.find({"timestamp" : ISODate("2023-09-13T09:46:24.000Z")}) the error occurs: Syntax error caused by unexpected ';' element in expression.
This is a MongoDB script, would anyone have any idea how to implement this script in Outsystem? because it works in mongoDB.
Hey @Alexandre Noleto ,
Can you please share the previous line of
db.evento.find({"timestamp" : ISODate("2023-09-13T09:46:24.000Z")})
Thanks & Regards,
Sudip Pal
Hi @Sudip Pal ,
This would be the complete line referring to the event collection, it is a query in a mongoDB database, which does not work in Outsystem, I have another one that works, see below:
"{ $and: [ { 'IT-DA-EMISSION': { $gte: '" + (Year(CurrDateTime())-1) + "1201'} }, { 'IT-DA-EMISSAO': { $ lte: '" + Year(CurrDateTime()) + "1231' } } ], $or: [ { 'IT-CO-UG-FAVORECIDA': 160505 }, { 'IT-CO-UG-FAVORECIDA': 167505 } ] }"
a filter in just one field: "{ 'IT-CO-PLANO-INTERNO': '28870679IA1' }"
The problem is this: db.evento.find({"timestamp" : ISODate("2023-09-13T09:46:24.000Z")})" which doesn't work, understand?
Thanks
Sorry but I can't help you on this. But don't worry there are so many MVPs and Champions. They will definitely try to help you.
Hi Alexandre,
How are you trying to run this script? I also fail to see how this is OutSystems-related, can you explain?
Hi Sudip Pal,
Can you try to execute the same script with other date field instead of timestamp ?
Checking some samples to understand the sintax
https://sparkbyexamples.com/mongodb/mongodb-query-dates-by-using-isodate/
# Usage of ISODate() function
db.student.find({ Admission_date: ISODate("2022-05-30T00:00:00.000Z") })
I believe that your error could be related to the timestamp field name which could be a reserved word. Try to rename that field.
Hope that it helps you
Hey @Alexandre Yip ,
Is this problem of yours related to OutSystems?
Sorry, I replied to you but the answer should be to @Alexandre Noleto , but as @Kilian Hekhuis and @Daniel Kuhlmann mention this has nothing related to Outsystems.
Regards,
Hi,
Need to agree with @Kilian Hekhuis how is this question OutSystems related?
Daniel
Sirs,
I believe there was a problem in the collection I was consulting, in another it worked.
I thought the problem was in Outsystem because the script ran in the IDE and not in Studio, but I concluded that the problem is in the collection, thank you all