neo4j-contrib / neomodel

An Object Graph Mapper (OGM) for the Neo4j graph database.
https://neomodel.readthedocs.io
MIT License
961 stars 232 forks source link

ArrayProperty does not support kind of "contains" filter #284

Open slava-poddubsky opened 6 years ago

slava-poddubsky commented 6 years ago

Model example:

from neomodel.core import StructuredNode
class User(StructuredNode):
    permissions = ArrayProperty(StringProperty(choices=['view', 'add', 'edit', 'delete']), required=True)

User.nodes.filter(permissions__icontains=['add', 'edit'])

Any ideas?

adamdelman commented 6 years ago

This should probably work something like this:

WHERE single(x IN n.permissions WHERE x IN ['add', 'edit'])
RETURN n;

or

MATCH (n) 
WHERE any(x IN n.permissions WHERE x IN ['add', 'edit'])
RETURN n;
greydot commented 5 years ago

Any updates on this?