2017-01-14 13 views
0

ノードを削除した後、結果にノードレコードを取得する際に問題があります。DETACH DELETEの後に削除されたノードを返します

私のクエリは次のとおりです。ここで私はいくつかのポスト(BELONGS_TO)に属しているコメントを削除しています

MATCH (user:User)-[:CREATED]->(comment:Comment)-[:BELONGS_TO]->(post:Post) 
WHERE comment.uuid = {commentUUID} AND post.uuid = {postUUID} AND user.uuid = {userUUID} AND NOT EXISTS(user.deleted) 
DETACH DELETE comment 
RETURN comment 

。また、コメントを削除したいユーザーがこのコメント(CREATED)の作成者でもあるかどうかを確認します。

クエリは正常に動作しますが、ノードとリレーションシップの削除は正常に実行されますが、返された値に満足していません。

それは代わりに私にこの結果を示しています。助けを

{ metadata: { deleted: true, id: 89 }, 
    paged_traverse: 'http://myDatabaseURI/db/data/node/89/paged/traverse/{returnType}{?pageSize,leaseTime}', 
    outgoing_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/out', 
    outgoing_typed_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/out/{-list|&|types}', 
    labels: 'http://myDatabaseURI/db/data/node/89/labels', 
    create_relationship: 'http://myDatabaseURI/db/data/node/89/relationships', 
    traverse: 'http://myDatabaseURI/db/data/node/89/traverse/{returnType}', 
    all_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/all', 
    all_typed_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/all/{-list|&|types}', 
    property: 'http://myDatabaseURI/db/data/node/89/properties/{key}', 
    self: 'http://myDatabaseURI/db/data/node/89', 
    incoming_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/in', 
    properties: 'http://myDatabaseURI/db/data/node/89/properties', 
    incoming_typed_relationships: 'http://myDatabaseURI/db/data/node/89/relationships/in/{-list|&|types}' } 

感謝を!

編集:

私は結果に私のデシベルURIを隠し、私の知る限りノードを削除するとき、あなたはノード自体を返すことで、そのプロパティを返すことができない、言うことができるようにmyDatabaseURI

答えて

1

でそれを置き換えます。

ただし、削除する前に、ノードのプロパティを取得し、ノード自体を削除した後のことを返すことができます。

MATCH (user:User)-[:CREATED]->(comment:Comment)-[:BELONGS_TO]->(post:Post) 
WHERE comment.uuid = {commentUUID} AND post.uuid = {postUUID} AND user.uuid = {userUUID} AND NOT EXISTS(user.deleted) 
WITH comment, properties(comment) as props 
DETACH DELETE comment 
RETURN props 

あなたが必要とするので、もしこれは、しかし、あなたのノードIDを取得することはありませんこれを返すには、マッププロジェクションを使用して、代わりにすべてのプロパティとノードIDを取得することができます。

+0

ありがとうございます。削除する前にコメントクエリを取得しますか? –

関連する問題