Skip to content

Find the distinct values for a specified column #2238

Closed

Description

@finnhlarsen

Find the distinct values for a specified column across a single table and returns the result,

Based on this discussion:
https://www.parse.com/questions/retrieving-unique-values

Activity

  1. flovilmart commented on Jul 8, 2016

    @flovilmart
    Contributor

    This is not implemented yet but you could work on a PR that implements it

  2. codebreach commented on Jul 16, 2016

    @codebreach
    Contributor

    I can take this up. Is there a API design for this?
    looking at how REST queries work I would assume it to look something like:

    curl -X GET \
      -H "X-Parse-Application-Id: REDACTED" \
      -H "X-Parse-REST-API-Key: REDACTED" \
      -G \
      --data-urlencode 'distinct=score' \
      https://api.parse.com/1/classes/GameScore
    
  3. flovilmart commented on Jul 16, 2016

    @flovilmart
    Contributor

    We usually Mark custom operators with a $ i.e. $distinct

  4. ranhsd commented on Sep 18, 2016

    @ranhsd
    Contributor

    Any news regarding this enhancement ?

    thanks.

  5. flovilmart commented on Sep 18, 2016

    @flovilmart
    Contributor

    @ranhsd It's up for the taking :)

  6. ranhsd commented on Sep 21, 2016

    @ranhsd
    Contributor

    @flovilmart This change should be done in the DataBaseController.js right ?

  7. acinader commented on Sep 21, 2016

    @acinader
    Contributor

    @ranhsd, I just poked around out of curiosity, I'd think that you'd need to add it first to RestQuery which will call find on the DataBaseController that will then use the MongoCollection.find (or postgress). Would at least need to touch a comment in LiveQuery/QueryTools.js

    This is just my quick look around. Seems like following how skip and limit are done are good parallels since they are constraints on a find, like distinct is.

    ymmv :)

  8. otmezger commented on Sep 30, 2016

    @otmezger

    +1 for this feature

  9. oallouch commented on Oct 3, 2016

    @oallouch
    Contributor

    I know MongoDB well and what would be great for me is a way to use mongo directly, with the aggregation framework and all. I know it's a lot a ask.

  10. joshgare commented on Nov 3, 2016

    @joshgare

    +1

  11. pewh commented on Mar 5, 2017

    @pewh

    +1 Any news on this implementation?

  12. natanrolnik commented on Mar 5, 2017

    @natanrolnik
    Contributor

    @pewh no, but PRs are more than welcome 😉

  13. Cliffordwh commented on Mar 6, 2017

    @Cliffordwh

    Im sure there was a PR already for this! can anybody confirm?

  14. ridergeek commented on Mar 14, 2017

    @ridergeek

    +1 for this. @Cliffordwh - I did a quick search on open/closed PRs and couldn't find this. Hoping someone will pick this up and implement soon.

  15. shi1hh commented on May 28, 2017

    @shi1hh

    china parse

    Key Operation

    • groupby
    • groupcount
    • sum
    • average
    • max
    • min
    • having
    curl -X GET 
        `-H "X-Bmob-Application-Id: Your Application ID" \
        -H "X-Bmob-REST-API-Key: Your REST API Key" \
        -G \
        --data-urlencode 'groupby=score' \
        https://api.bmob.cn/1/classes/GameScore
    
    [
        {
            "score": 78
        },
        {
            "score": 89
        }
    ]
    
    
    curl -X GET \
        -H "X-Bmob-Application-Id: Your Application ID" \
        -H "X-Bmob-REST-API-Key: Your REST API Key" \
        -G \
        --data-urlencode 'sum=score&groupby=createdAt&groupcount=true&order=-createdAt' \
        https://api.bmob.cn/1/classes/GameScore
    
    [
        {
            "_sumScore": 2398,
            "_count": 10,
            "createdAt": "2014-02-05"
        },
        {
            "_sumScore": 100,
            "_count": 2,
            "createdAt": "2014-01-01"
        },
    ]
    
    curl -X GET \
        -H "X-Bmob-Application-Id: Your Application ID" \
        -H "X-Bmob-REST-API-Key: Your REST API Key" \
        -G \
        --data-urlencode 'sum=score1,score2&groupby=createdAt,playerName&order=-_sumscore1' \
        https://api.bmob.cn/1/classes/GameScore
    
    [
        {
            "_sumScore1": 399,
            "_sumScore2": 120,
            "playerName": "John"
            "createdAt": "2014-02-05"
        },
        {
            "_sumScore1": 299,
            "_sumScore2": 250,
            "playerName": "Bily"
            "createdAt": "2014-02-05"
        },
        {
            "_sumScore1": 99,
            "_sumScore2": 450,
            "playerName": "John"
            "createdAt": "2014-02-01"
        },
    ]
    

    link http://docs.bmob.cn/data/Restful/b_developdoc/doc/index.html

  16. wy1024 commented on Jun 26, 2017

    @wy1024

    After hours of looking, the only solution i found is to get all rows and do distinct by yourself.

    To get all rows, beyond the limit of 1000, and the skip limit of 10000, this is a great solution.
    http://cyber-duck.github.io/2016/03/18/how-to-retrieve-all-objects-on-parse-without-api-limitation/

  17. natanrolnik commented on Jun 27, 2017

    @natanrolnik
    Contributor

    @davimacedo We could have some query parameters to select distinct values, no? What do you think?

  18. davimacedo commented on Jun 28, 2017

    @davimacedo
    Member

    I think the API suggested in the beginning of the thread would be good:
    curl -X GET
    -H "X-Parse-Application-Id: REDACTED"
    -H "X-Parse-REST-API-Key: REDACTED"
    -G
    --data-urlencode 'distinct=score'
    https://api.parse.com/1/classes/GameScore

    We would have to handle this in ClassesRouter -> rest -> RestQuery -> DataBaseController -> Mongo and Postrgres adapters.

    For mongo we can implement it using https://docs.mongodb.com/manual/reference/method/db.collection.distinct/.

    For postgres using SELECT DISTINCT ... (https://www.postgresql.org/docs/9.0/static/sql-select.html)

    I've just added it to my personal kanban. I can try to write something soon.

  19. BRC-solutions commented on Aug 27, 2017

    @BRC-solutions

    We really need this

  20. dplewis commented on Nov 12, 2017

    @dplewis
    Member

    Closes #2238 Via #4207

  21. fmendoza commented on Dec 21, 2017

    @fmendoza

    Does the new aggregate queries support pointers?

  22. dplewis commented on Dec 22, 2017

    @dplewis
    Member

    I don’t think so. But it does support dot notation. Feel free to open a PR, we’ll review it. You could do distinct(PointerField.objectId) but that’s just a workaround

  23. fmendoza commented on Dec 22, 2017

    @fmendoza

    yeah I tried your suggestion before (pointer.objectId) before but no results

  24. dplewis commented on Dec 22, 2017

    @dplewis
    Member

    It’s up for the taking 😉

  25. added
    type:featureNew feature or improvement of existing feature
    and removed on Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions