简体   繁体   English

Neo4j-如何在同一批处理操作中创建唯一节点并设置标签

[英]Neo4j - How to create a unique node and set a label in the same batch operation

Can I create a unique node and set a label in the same batch operation? 是否可以在同一批处理操作中创建唯一节点并设置标签?

I tried to do with this json but unfortunately the server fails 我尝试使用此json,但不幸的是服务器失败了

[
    {
        "id": 0,
        "method": "POST",
        "to": "/index/node/PhoneBook?uniqueness=get_or_create",
        "body": {
            "key": "mobilePhone",
            "value": "9999999999",
            "properties": {
                "firstName": "fn1",
                "lastName": "ln1",
                "mobilePhone": "9999999999"
            }
        }
    },
    {
        "method": "POST",
        "to": "{0}/labels",
        "body": [
            "Contact"
        ]
    }
]

Use cypher instead: 请改用cypher:

MERGE (p:PhoneBook {mobilePhone:{phoneNo}} 
ON CREATE SET p += {properties}, SET p:Contact

params: 参数:

       {phoneNo: "9999999999", "properties": {
            "firstName": "fn1",
            "lastName": "ln1",
            "mobilePhone": "9999999999"
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM