N1QL query to get the latest document having same value in other property in a join result of two different documents in couchbase

I have a bucket called “prices”, with two different types of documents “intent” and “request

"intent" (id = “intent1”) { “locationDSL”: “some_location” “product”: “some_product1” }

"intent" (id = “intent2”) { “locationDSL”: “some_location2” “product”: “some_product” }

"request" (id = “request1”) { “intentId”: “intent1”, “createdDateTime”: “2019-04-01” }

"request" (id = “request2”) { “intentId”: “intent1”, “createdDateTime”: “2019-05-01” }

"request" (id = “request3”) { “intentId”: “intent2”, “createdDateTime”: “2019-06-01” }

"request" (id = “request4”) { “intentId”: “intent2”, “createdDateTime”: “2019-07-01” }

so I have 2 requests(“request1” and “request2”) for “intent1” and 2 requests(“request3” and “request4”) for intent2, so I need to join “intent1” and “intent2” with latest requests (request having latest createdDateTime) i.e “request2” and “request4” respectively

i am able to join the documents , but the join is not with latest reqest but all request matching intent.id