Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

326
Visualizações
How to filter a list using "like" operator with a parameter in a REST aplication?

I'm building a web application using REST; more specifically, Node.js. So far, I've had no problems formatting the URL (using ? and & operators; limit and skip to filter fields, for example).

Now, I need to filter a list of Sensor Readings to show only the data that was inserted in a specific day.

The date is being stored as a String in MongoDB in the format "dd/mm/yyyy hh:mm:ss", or "25/04/2017 10:20:56". The reason I'm storing it as a String rather than as datetime is because it takes less space, as there's limitations of storage in the project.

Using the "like" operator in the URL (%, that is), I've successfully managed to filter some other String fields, such as /sensorReading/?deviceNum=MBA%. However, when I try to filter the date String, it fails.

I've tried in many different ways, but nothing is working, even when I don't use the like operator and put the full string (space is being replaced as %20):

/sensorReading/?dateString=13%
/sensorReading/?dateString=1%
/sensorReading/?dateString=%1%
/sensorReading?dateString=1%
/sensorReading/?dateString=13/04/2017%2012:57:16

My guess is that it has something to do with the '/' character present in the String, to separate day, month and year.

Is there a way to do this via URL, or will I have to do it in the front end of my aplication? For the front, I'm using JavaScript and AngularJS.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda