Sorting-by-count-2

Recommended approach works (Sorting by count - #2 by MichelDiz)

I’ve found my mistake:
it seems that <dgraph.type> has no index by default, so Dgraph didn’t retrieve all the nodes by eq(<dgraph.type>, "password") even though needed node has <dgraph.type>=="password" (checked), but did what I wanted with has(<prop.password>)

{
  passwords as var(func: has(prop.password)){
    used_count as count(<password_uid>)
  }
    
  _(func: uid(passwords), orderdesc: val(used_count), first:1){
    used_count:used_count
    password:prop.password
  }
}