I am working with Cloude Code to develop a more complex query, but I am having trouble accessing the automatically created "createdAt" property by Parse. Here is my code:
Parse.Cloud.define("get_time", function(request, response)
{
var query = new Parse.Query("Test");
var today = new Date(); // retrieves today's date
var thirdDaysAgo = new Date(today - 1000 * 60 * 60 * 24 * 30); // retrieves the date from 30 days ago
var threeHoursAgo = new Date(today - 1000 * 60 * 60 * 1); // retrieves the date from 3 hours ago
query.greaterThan("createdAt", thirdDaysAgo);
query.greaterThan("createdAt", threeHoursAgo);
query.descending("createdAt");
query.find({
success: function(results)
{
if(results.length > 0)
{
var finalArray = [];
for (i = 0; i < results.length; i++)
{
var dataCreated = results[i].get("createdAt");
finalArray.push(dataCreated);
}
response.success(finalArray);
}
},
error: function()
{
response.error("time lookup failed");
}});
});
The finalArray is only storing null objects.