0
我想使用COLLECT函數來構造使用文字地圖語法的對象的數組。但是,如果我使用的屬性沒有返回值,我寧願返回一個空數組,而不是數組的對象元素爲其屬性保留空值。我如何忽略這些值並返回[]而不是這個?Cypher查詢:如何ingnore文字地圖語法當值爲空
[
{
property_a: null,
property_b: null
}
]
這裏是我的嘗試暗號查詢:
MATCH (n)-[r]-()
WHERE n.id={_nodeid}
WITH n
OPTIONAL MATCH (n)-[instantiationlist:INSTANTIATES]->(target)
WITH n, COLLECT({
container : instantiationlist.container,
target : target.id
}) AS instantiationset
RETURN n.id AS id,
n.name AS name,
n.color AS color,
n.background AS background,
LABELS(n)[0] AS type,
instantiationset AS instantiations;
我想有[]的數值爲instantiationset,而不是這樣的:
[
{
"container": null,
"target": null
}
]