Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation]: Provide an example of how to use count a predicate that with a filter #462

Open
rahst12 opened this issue Feb 14, 2023 · 0 comments

Comments

@rahst12
Copy link

rahst12 commented Feb 14, 2023

What version of Dgraph is the target?

v21.03.1

Documentation.

The @count documentation could be improved to show examples where the predicate is filtered inside the count, example: count(friend @filter(NOT eq(name, "Sarah")))

{
  michael(func: eq(name, "Michael")) @recurse(depth:10){
    name
    age
    owns_pet
    friend~
    friend @filter(NOT eq(name, "Sarah"))
    count(friend @filter(NOT eq(name, "Sarah")))
  }
}

Discuss post which ultimately led to an understanding that @filter and @count can be combined together: https://discuss.dgraph.io/t/how-to-filter-by-count/16915/6

Discussion post where the above information was learned with Q&A: https://discuss.dgraph.io/t/does-order-in-a-dql-query-matter/18274

GitHub Ticket #461 also has references with additional confusing behavior of @filter with @recurse

Additional information.

No response

@MichelDiz MichelDiz transferred this issue from dgraph-io/dgraph Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant