Page 1 of 2

_updatedAt headaches

Posted: Sun Feb 16, 2014 8:54 am
by Chris A

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


_updatedAt headaches

Posted: Sun Feb 16, 2014 9:25 am
by Alena Prykhodko

Hhi Chris,

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


_updatedAt headaches

Posted: Sun Feb 16, 2014 9:44 am
by Chris A

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


_updatedAt headaches

Posted: Sun Feb 16, 2014 11:17 am
by Alena Prykhodko

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


_updatedAt headaches

Posted: Sun Feb 16, 2014 3:05 pm
by Alena Prykhodko

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.


_updatedAt headaches

Posted: Sun Feb 16, 2014 3:07 pm
by Chris A

It works, thanks.


_updatedAt headaches

Posted: Thu Dec 25, 2014 9:19 pm
by Yaniv

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?


_updatedAt headaches

Posted: Fri Dec 26, 2014 6:08 am
by Yurii Orishchuk

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.


_updatedAt headaches

Posted: Sat Apr 09, 2016 9:38 pm
by frustrateddeveloper

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?


_updatedAt headaches

Posted: Sat Apr 09, 2016 11:47 pm
by Galyna Abramovych

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".