Hi,
Running into a brick wall using the javascript driver to migrate JSON data into Neo4j.
Simple transaction wrapper:
const n4jTxn = ({ neo4jDriver, unitsOfWork }) => {
const session = neo4jDriver.session({ defaultAccessMode: neo4j.session.WRITE});
return session.writeTransaction((txn) => {
const promises = _.map(unitsOfWork, (uow) => {
console.log(`[n4jTxn] unitOfWork: ${JSON.stringify(uow, {}, 2)}`);
return txn.run({ text: uow.query, parameters: uow.parameters});
});
return Promise.all(promises);
}).then((results) => {
console.log(`[n4jTxn] result: ${JSON.stringify(results, {}, 2)}`);
session.close();
return results;
}).catch((error) => {
session.close();
throw error;
});
};
Yields the dreaded "Cannot merge node using null property value for xyz..."
[n4jTxn] unitOfWork: {
"query": "UNWIND $users AS u MERGE (newUser:User { _id: u._id, name: u.name, email: u.email, accountId: u.accountId }) RETURN newUser",
"parameters": {
"users": [
{
"_id": "5cc1efebe13133250e8bc9c6",
"name": "Admin 1",
"email": "admin1@example.com",
"accountId": "de34d0a8-4715-40aa-8cc5-dasdfjad"
},
{
"_id": "5cc1efebe13133250e8bc9c9",
"name": "GC 40",
"email": "gc40@examplecom",
"accountId": "b70f5117-4f1f-45a9-8278-addkadk"
},
{
"_id": "5cc1efebe13133250e8bc9cb",
"name": "Architect 1",
"email": "architect1@example.com",
"accountId": "3937f941-040d-40ed-b1ee-alsdfa"
}
]
}
}
[migrate -- migrateUsers] Neo4jError: Cannot merge node using null property value for accountId.
Any thoughts on what's going on? Thanks.