Filter query issue

Hi All,
I am having below schema entities and relationship for one of my use case.

type RiderDevice{
user_imei
}
type Vehicle {
car_number
}
type DriverDevice {
driver_imei
}

riderDevice: uid @reverse .
driverDevice: uid @reverse .
car_number: string@index(term) .
user_imei: string@index(term) .
driver_imei: string@index(term) .

Sample mutation payload:

 {
"set": [{
		"car_number": "S283CCR",
		"original_car_category": "luxury_sedan",
		"driverDevice": {
			"driver_imei": "1350000000344461",
			"riderDevice": {
				"user_imei": "1350000000344462"
			}
		}

	},
	{
		"car_number": "S283CCR",
		"original_car_category": "luxury_sedan",
		"driverDevice": {
			"driver_imei": "1350000000344467",
			"riderDevice": {
				"user_imei": "1350000000344467"
			}
		}
	},
	{
		"car_number": "S283CCR",
		"original_car_category": "luxury_sedan",
		"driverDevice": {
			"driver_imei": "1350000000344478",
			"riderDevice": {
				"user_imei": "1350000000344467"
			}
		}
	}


]

}

I am trying to find all DriverDevice where driver_imei used in RiderDevice as user_imei .
Query which i tried:

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

Thanks

Thanks for posting the details @dharm0795.
Please try this query. We can use a variable to collect the user_imei and use in the filter.

{
   qUserIMEI(func: has(user_imei))@normalize{
    ui as user_imei
  }
  
  q(func: has(driver_imei)) @filter(eq(driver_imei, val(ui))){
    uid
    driver_imei
    riderDevice{
      user_imei
    }
  }
}

Here is the result I get.

{
  "data": {
    "qUserIMEI": [],
    "q": [
      {
        "uid": "0x1",
        "driver_imei": "1350000000344467",
        "riderDevice": {
          "user_imei": "1350000000344467"
        }
      }
    ]
  }
}

Please try this and let us know.

This worked thanks for the help.

Hi @dharm0795. Great!
Please consider marking the question as solved so that other users can refer to this as well.