Chris A
Posts: 0
Joined: Tue Feb 11, 2014 2:25 pm

_updatedAt headaches

In a service, I'm trying to get from a collection all the records updated less than 5 minutes ago, using the _createdAt column in the 'where' clause. I've tried all sort of combinations of date formats and everything I could read in this forum and the docs. What is the right syntax?

The docs say:
{ "time" : {"$lt" :"2014-01-17 00:00:00.000"} }

But this doesn't work (test successful but empty answer (not even [ ]):
{ "_updatedAt" : { "$gt" :"2013-12-01 00:00:00.000"} }

Thanks

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

_updatedAt headaches

Hhi Chris,

The syntax is correct, how do you map the response? Please show us a screen shot.

Chris A
Posts: 0
Joined: Tue Feb 11, 2014 2:25 pm

_updatedAt headaches

Hi Alena,

I'm not even mapping it yet. Just testing it and the answer is empty.

Image
Image

And it works without the where clause:
Image

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

_updatedAt headaches

Chris, we'll test more and update as soon as possible.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

_updatedAt headaches

Chris,

The syntax should be as follows:

pre{"_updatedAt":{"$gt":{"$date":"2013-12-01T00:00:00.000Z"}}}
/pre
Note, there should be ISO date format:

T - before
Z - after

We'll update tutorials.

Chris A
Posts: 0
Joined: Tue Feb 11, 2014 2:25 pm

_updatedAt headaches

It works, thanks.

Yaniv
Posts: 0
Joined: Wed Jun 12, 2013 8:38 pm

_updatedAt headaches

I'm using server code and trying to query Files collection based on _createAt column using below code.
The issue that I'm facing is that I'm getting ALL records and not based on the query parameter date.

Code:
var XHRResponse = XHR.send("GET", "https://api.appery.io/rest/1/db/files", {
"headers": {
"X-Appery-Database-Id": dbId,
"X-Appery-Master-Key": dbMasterKey
},
"parameters": {
"where": '{"_createdAt":{"$gt":{"$date":"' + moment().zone("+02:00").add('days', -1).format('YYYY-MM-DD hh:mm:ss.SSS') + '"}}}'
}
});

*Even if I set static date I'm getting ALL records:
"where": '{"_createdAt":{"$gt":{"$date":"2014-12-24 04:21:00.256"}}}'

Can you tell me why?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

_updatedAt headaches

Hi Yaniv,

Unfortunatly file api not not supports searching.

Details: http://devcenter.appery.io/documentat...

But you can search it with server script by field you need.

Regards.

frustrateddeveloper
Posts: 0
Joined: Fri Apr 08, 2016 4:06 am

_updatedAt headaches

Can you explain T and Z a bit here?

You are saying the _updateAt had to be before 2013-12-01 but at any time of the day?

Whereas "2013-12-01T12:00:00.000Z"

would be on any day before 2013-12-01 but after noon?

Galyna Abramovych
Site Admin
Posts: 84
Joined: Tue Mar 22, 2016 6:03 pm

_updatedAt headaches

Hello,

"2013-12-01T12:00:00.000Z" will indicate the start of the time interval.

If a time zone designator is required, it follows the combined date and time. For example, "2007-04-05T14:30Z" or "2007-04-05T12:30-02:00".
If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".

A single point in time can be represented by concatenating a complete date expression, the letter T as a delimiter, and a valid time expression. For example, "2007-04-05T14:30".

Return to “Issues”