Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse.Query sort by date

Is there a way to sort by createdAt time in parse?

For example:

var Users = Parse.Object.extend("Users"),
    Query = Parse.Query;

var userQuery = new Query(Users);

userQuery.equalTo("userName", Name);

userQuery.ascending("createdAt");
like image 740
user1324887 Avatar asked Jul 05 '14 22:07

user1324887


1 Answers

Yes, that is fine... but the string name of the Users class is not Users, it's "_Users".. better still: new Parse.Query(Parse.User);

var userQuery = new Parse.Query(Parse.User);
userQuery.ascending("createdAt");

But... Your user class should not be user queryable. This should be locked down in the class-level permissions section of the data browser, and only Cloud Code using the Master Key should be able to query users.

like image 81
Fosco Avatar answered Oct 15 '22 20:10

Fosco