0
votes

In a cloud function hosted on Parse.com, I used to have the following lines of code working:

var recordListQuery;
recordListQuery = new Parse.Query("TheClassName");
recordListQuery.descending("currentRecord,-updatedAt");

When moving the code to Parse-Server I got this error message:

.... [Error]: (
        {
        code = 105;
        message = "Invalid field name: -updatedAt.";
    }
) (Code: 141, Version: 1.14.2)

After taking a close look at the database, I noticed some changes in Parse-Server, updatedAt is now called _updated_at therefore I changed the above last line of code to:

recordListQuery.descending("currentRecord,-_updated_at");

But now I get the error message:

.... [Error]: (
        {
        code = 105;
        message = "Invalid field name: -_updated_at.";
    }
) (Code: 141, Version: 1.14.2)

Obviously I am not doing it all right. What am I missing?

1
Can you check the contents of your _SCHEMA collection in Mongo, and also the response to the schemas endpoint? - Cliffordwh
Thanks for the suggestion. I ended up by finding a solution in the meanwhile; after quite a bit of time. I posted my own answer. - Michel

1 Answers

0
votes

In case it may be useful to someone, after trying many possibilities, here is what I found and it works.

I replaced this line of code:

recordListQuery.descending("currentRecord,-updatedAt");

by these two:

recordListQuery.descending("currentRecord");
recordListQuery.addAscending("updatedAt");