137
Views
9
Comments
Syntax error caused by unexpected ';' element in expression
Question

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.

2023-09-06 07-26-35
Sudip Pal

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

UserImage.jpg
Alexandre Noleto

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

2023-09-06 07-26-35
Sudip Pal

Hey @Alexandre Noleto ,

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.

Thanks & Regards,

Sudip Pal


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Alexandre,

How are you trying to run this script? I also fail to see how this is OutSystems-related, can you explain?

UserImage.jpg
Alexandre Yip

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.


db.evento.find({"timestamp" : ISODate("2023-09-13T09:46:24.000Z")}) 


Hope that it helps you

2023-09-06 07-26-35
Sudip Pal

Hey @Alexandre Yip ,

Is this problem of yours related to OutSystems?

Thanks & Regards,

Sudip Pal

UserImage.jpg
Alexandre Yip

Hi Sudip Pal, 

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,


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

Need to agree with @Kilian Hekhuis how is this question OutSystems related?

Regards,

Daniel

UserImage.jpg
Alexandre Noleto

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.