Skip to content
This repository was archived by the owner on Mar 29, 2025. It is now read-only.
This repository was archived by the owner on Mar 29, 2025. It is now read-only.

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

@rahst12

Description

@rahst12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions