0

After asked this question : topic restHeart with a satisfactory answer, i have a new question.

I used this http restHeart request :

PATCH http://test:8081/purge/test3 { rts: [
{
 "name": "addRequestProperties", 
 "phase": "REQUEST", 
 "scope": "CHILDREN",
 "args": { "log": [ "dateTime", "epochTimeStamp" ] } }]}

and now when I insert some json data, mongo db automaticaly add datetime and epochTimeStamp like that :

"invoiceNumber": "6666"
"log": {
    "dateTime": "[23/Mar/2016:16:24:24 +0000]"
    "epochTimeStamp": 1458750264
}

So my problem is now to make my query.

I tried something like that but does not work :

http://test:8081/purge/test3?filter={"log":{"epochTimeStamp":{"$lte":"1458750378"}}}

Finally my query retrieve nothing...

Version mongo 3.2 / restheart 1.2

Hope you can help me :)

Community
  • 1
  • 1
don
  • 51
  • 1
  • 4

1 Answers1

1

You are passing a string to the $lte operator.

You need to pass a number:

  http://test:8081/purge/test3?filter={"log.epochTimeStamp":{"$lte": 1458750378}}
Andrea Di Cesare
  • 1,125
  • 6
  • 11
  • Unfortunetly it does not work ! :/. I also try http://test:8081/purge/test3?filter={"log":{"epochTimeStamp":1458811670}}} – don Mar 24 '16 at 09:33
  • I also try to use your query like that : `http://test:8081/purge/test3?filter={"$and":[{"log":{"epochTimeStamp":{"$gte":1458312597}}},{"log":{"epochTimeStamp":{"$lte":1458812890}}}]}`. Nothing retrieved :( – don Mar 24 '16 at 10:00
  • I fixed the query in my answer to use the dot notation, can you try it? – Andrea Di Cesare Mar 24 '16 at 13:01