Using aggregation stages without a leading '$' is deprecated and will be removed in a future version

I tried using query.distinct() as per documentation. But I get a warning that I should add the leading $ sign to it. Which breaks the query. What is the new proper way of getting distinct values without aggregation pipeline?

    const sQuery = new Parse.Query("Deliveries");
    sQuery.equalTo("user", req.user);
    sQuery.greaterThan("createdAt", new Date(timeframe));
    sQuery.equalTo("status", "accepted");
    const totalDonatorsHelped = await sQuery.count({ useMasterKey: true });

What versions of the JS SDK and Parse Server are you using? This would most likely be fixed by updating your JS SDK to the latest version

1 Like

You’re right, it’s been fixed in version 6. I’ll pay attention in the future. Thank you.

Upgrading to 6.0. caused this Error: Router.use() requires a middleware function but got an object I opened an issue on GitHub.

Please review the migration guide when updating major versions, as major versions have breaking changes:

1 Like

This one helped. Thanks a lot.

In the migration guide this line const ParseServer = require("parse-server") needs to be swapped with const ParseServer = require("parse-server").ParseServer; Otherwise it gives ParseServer is not a constructor error. JFYI