This doesn’t look good at all, unless you are a hacker creating a password dictionary to use in attacks.
Firstly, passwords should not be exposed in the DB. If you are doing this, stop right now! NOT SAFE. You should encrypt it. Anf if you encrypt it, this approach won’t work. Unless we add some loops in DQL.
e.g “For each node, try this password and count”. But that would be unethical, as you are brute forcing your database with your users data…
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
}
}
Yep, no mistake in lowercase/uppercase, “trust me, I’m C++ programmer”.
And yes, dgraph.type is not being indexed properly, but all my artificial predicates were indexed without any problem (they show proper count), will rely on them.