SET a property during a custom cypher query

79 views Asked by At

Is something like this advisable?

GetConversationsByMember(userId: ID!): [Conversation]
    @cypher(
        statement: """
            MATCH (u:User {id: $userId})-[:IN_CONVERSATION]->(c:Conversation)-[:NEWEST_MESSAGE]->(newestMessage)
            SET c.hasReadNewest = EXISTS((u)-[:HAS_READ]->(newestMessage))
            RETURN c
    """)

I have the hasReadNewest property on the Conversation node and I want to dynamically set it when getting all conversations for a user. Right now I'm running into this error Neo4jError: Set property for property 'hasReadNewest' is not allowed for user 'neo4j' with roles [PUBLIC, admin] restricted to READ. and questioning this approach altogether.

0

There are 0 answers