Bidirectional Relationship query based on time

Hello Team,

I am writing a cypher query to find out how many people one person met with another. A person has a bidirectional relationship HAS_MET which indicates the number of counts they met each other as well as a timestamp.

query looks like this

//ahmad contact of contact in last 14 days
match (p:Person)-[rel1:HAS_MET]->()-[rel2:HAS_MET]->(other)
with p,other,rel1.timeStamp as firstContactTime, rel2.timeStamp as secondContactTime
where p.id=1 and datetime() > firstContactTime >datetime("2020-04-03T19:32:24") and datetime() > secondContactTime >datetime("2020-04-03T19:32:24")
return p, other

The above query will provide a response of Ahmad's contact and contact of a contact.

Now I am modifying the query to look like this

MATCH (p:Person)-[:HAS_MET*2]->(other)
WHERE p.id=1 and NOT (p)-[:HAS_MET]->(other)
return other, p

In this query how do I access timestamp property of HAS_MET relationship?

met

it is accessible in several ways. I suspect you may be most interested in just the last relationship in each path, not all the relationships? if that is the case you can explicitly access the last relationship in each path like this

MATCH t=(p:Person)-[:HAS_MET*2]->(other)
with last(relationships(t)) as r
return r.timeStamp

Thanks Joel, it works,
finally query look like this, as per your suggestion

MATCH a= (p:Person)-[:HAS_MET*2]->(other)
with *, last(relationships (a)) as rel
WHERE p.id=1 and NOT (p)-[:HAS_MET]->(other) and datetime() >rel.timeStamp>datetime("2020-04-03T19:32:24")
return other, p, rel