neode icon indicating copy to clipboard operation
neode copied to clipboard

Using filter on relationships

Open natamvo opened this issue 5 years ago • 1 comments

Hello there, I need some help to do something, if anyone can help me if this has already been done.

{
    friends: {
        type: "relationships",
        target: "Person",
        relationship: "FRIENDS",
        direction: "out",
        properties: {
            intimacy: {
                type: 'string',
                valid: ['close', 'regular']
            }
        },
        eager: true // can be false
    }
}

I want do do something like

const people = person.all({ 'friends.intimacy': 'close' })

or

const people = person.all()
const friends = people.get('friends', { intimacy: 'close' })

Is it possible?

natamvo avatar Dec 02 '19 14:12 natamvo

This isn't possible at the moment. From a Neo4j point of view I'd recommend against this because it won't perform very well. Essentially you'd be going through every Person node, then expanding every FRIENDS relationship and filtering on a property - this would be expensive.

Can I ask the use case?

adam-cowley avatar Jan 06 '20 12:01 adam-cowley