Filtering issue

Use cases description:

I have two entities driverDevice and riderDevice which have parent children relationship.

riderDevice {
user_imei
}
driverDevice {
driver_imei
}

I want to query something like this:

{
  driverDevice(func:has(driver_imei)) {
    driver_imei 
    riderDevice@filter(eq(user_imei, driver_imei))	    { 
     user_imei 
    }
  }     
}

But I am not able to use driver_imei value in in filters.
Please help on this.

Welcome @dharm0795 to the Dgraph community!

It looks like you are trying to “join” driverDevice and riderDevice using a filter eq(user_imei, driver_imei). Graph databases like Dgraph cannot join distinct nodes in the way an SQL database can. You will need to define a schema where the relationship between driverDevice and riderDevice. This can be done using a UID predicate.

I suggest that you go through the tutorial series here. Then, please prepare a schema which reflects the types and their relationships. Please create some data and try to traverse. If you feel you need help, please share your schema, sample data and where you had an issue with us and we wil be glad to help.