Q:

Compare property that can be a timestamp or FALSE

having a property on Users that is FALSE when a user is still active or having a timestamp when a user left I want to catch users that are present during a timewindow. I understood that Cypher doesnt have date comparison to ask e.g. for BETWEEN (month/year) AND (month/year) so I put timestamps on the properties.
I tried to get the user by this query:
MATCH (u:User) WHERE u.end_date IS FALSE OR u.end_date > 1422658800 RETURN u

This should return all users that are still active (end_date = FALSE) or if the end_date is beyond the current timestamp (here 1422658800).
Unfortunately I stuck as NEO4J claims: Don't know how to compare that. Left: false (Boolean); Right: 1422658800 (Long)
I hoped it would either accept the Boolean or the Integer, but it seems to check both conditions and fails when comparing Boolean to Long Integer - which is fine.
Any idea how I could build a query that can handle both criteria so I can filter the correct users?
Thanks,
Balael

A:

I would just not store the end_date if it was not set, just remove the property.
Then you can use:
MATCH (u:User) 
WHERE coalesce(u.end_date,2^32) > 1422658800 
RETURN u

If you want to stick with your model, which I do not encourage.
You can turn your boolean into a number first.
MATCH (u:User) 
WHERE (case u.end_date when false 2^32 else n.foo end)
      > 1422658800 
RETURN u

