docs icon indicating copy to clipboard operation
docs copied to clipboard

Mistake on website

Open karantin2020 opened this issue 9 years ago • 1 comments

In live example on your website there is a mistake. in code

r.table('game').orderBy('score').limit(3).changes()

you show TOP PLAYER SCORES.

In your docs orderBy func has default ascending order. So result must be LOWER PLAYER SCORES.

Something like this:

r.table('game').orderBy('score').limit(3)
[
  {
    "id":  "1f759459-0879-4f60-ad9c-04660c156e3f" ,
    "player":  "anthony" ,
    "score": 32
  } ,
  {
    "id":  "6c20ce37-7ecf-4053-a00d-6a5465135c30" ,
    "player":  "jeroen" ,
    "score": 33
  } ,
  {
    "id":  "8c0a26b8-94fb-4aa7-9374-a92255391211" ,
    "player":  "zachary" ,
    "score": 36
  }
]

The other result with using r.desc:

r.table('game').orderBy(r.desc('score')).limit(3)
[
  {
    "id": "45f8099a-6187-4cca-9f4d-f014d33083c8",
    "player": "josh",
    "score": 138
  },
  {
    "id": "2a870b82-0d65-4da3-bbbc-c8936b2064b2",
    "player": "slava",
    "score": 115
  },
  {
    "id": "99f95df6-f3ef-48f3-bfc1-54b42a4eeae4",
    "player": "skyla",
    "score": 103
  }
]

Or I understood something wrong?

karantin2020 avatar Jul 16 '16 10:07 karantin2020

Hi @karantin2020, you're right, good catch.

The query on the website is primarily for illustrating the general concept of changefeeds, so keeping it simple might actually be more important than being correct here. @mglukhovsky what do you think?

danielmewes avatar Jul 18 '16 23:07 danielmewes