Skip to content

Distinct query - limit and order? #4880

Closed
@rihadavid

Description

@rihadavid

Hi, I've just discovered a distinct query and I tried to use it to get unique comment authors from a list of comments. The query restrictions work well, but it seems that it is not possible to get like "5 newest authors", because the ordering and limiting do not work.

I think this is most probably not implemented, it would be awesome if somebody could do it :)
I have no idea how complicated this could be. What do you think @dplewis ? :) 🥇
Of course, I can use just a usual query, but the distinct query seems much more efficient, I like it!

var subcommentsQuery = new Parse.Query("Comment");

//those work as expected
subcommentsQuery.equalTo("pComment", savedObject);
subcommentsQuery.notContainedIn("author", [editingUser, savedObject.get("author")]);
if (savedObject.get("forAll"))
    subcommentsQuery.greaterThan("createdAt", addHours(new Date(), -36));

//those does not work at all (when using the distinct query)
subcommentsQuery.ascending("createdAt");
subcommentsQuery.limit(1);

return subcommentsQuery.distinct("author").then( ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions