This really confused me. The “first: 5” in first query seems skipping some node that is not the type of “Person”. So it skipped first 4 node that is not type “Person” and return the 5th one that is a type “Person”.
Actually, I just went through the queries again and I don’t think there’s an issue. Let me explain further.
{
q(func: type(Person), first:5) {
name@en
}
}
This query is getting the first five nodes with a dgraph.type value. These nodes are not guaranteed to have a name (or more specifically a name with a @en tag). If they don’t they won’t show up in the results. You can make them show up by changing the query to.
The other query goes through all the nodes that have a name@en value. Since we tagged all the nodes with a type in this dataset, the five results show up.
Hope this helps clear up why the results of the two queries are different.