0

I have the following rethinkdb data schema :

user_id -- generated by the application
point   -- given to the user on a successful completion of task

How can I select a single document AND its position amongst the other document in the collection, when sorted by score DESC. So if the collection data looks like this, when sorted by score:

user_id | score
---------------
10      |  100
01      |  90
...............
22      |  01

I was able to find a solution to a similar problem (with MYSQL as the database.) Here is the link:
MySQL get row position in ORDER BY

Currently i am loading the dataset at Node.js level, but is this possible at query level computation ?

Community
  • 1
  • 1
  • 2
    Possible duplicate of [How do I get the rank / row number for a row?](http://stackoverflow.com/questions/33330073/how-do-i-get-the-rank-row-number-for-a-row) – Tomalak Oct 20 '16 at 08:28
  • sorry, for the duplicate question, my query terms were wrong. – user284873 Oct 21 '16 at 07:37

0 Answers0