Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-15-2021 09:06 PM
Dear developers please help me!
I want to import json data into neo4j database. Now this is my data in Mongodb.
I want to import like that:
Here is my cipher SQL:
CALL apoc.load.json("file:///data.json")
yield values unwind values as value
merge (general_info:Company {id: value.info.register_number})
on create set general_info.name = value.info.company_name,
general_info.form = value.info.company_form,
general_info.type = value.info.company_type,
general_info.numberOfOwner = value.info.number_of_owner,
general_info.companyLocation = value.info.company_location,
general_info.registerDate = value.info.regiter_date
with value.stakeHolders as stakeHolder
merge (stake:Person {id: stakeHolder.last_name+'.'+stakeHolder.first_name})
on create set stake.firstName = stakeHolder.first_name,
stake.lastName = stakeHolder.last_name,
stake.country = stakeHolder.country,
stake.category = stakeHolder.category,
stake.registeredDate = stakeHolder.date
merge (stake)-[rel:OWNED]->(general_info)
with value.ceo as ceos
merge (cc:Person {id: ceos.last_name+'.'+ceos.first_name})
on create set cc.firstName = ceos.first_name,
cc.lastName = ceos.last_name,
cc.country = ceos.country,
cc.category = ceos.category,
cc.registeredDate = ceos.date
merge (cc)-[rel1:CEO]->(general_info)
with value.area as areas
merge (arr:Area {id: areas.code})
on create set arr.title = areas.title,
arr.registeredDate = areas.date
merge(arr)-[rel2:HAS_AREA]->(general_info)
return values
01-16-2021 09:38 AM
Do you have sample JSON data you're trying to import (in which case I'll try to take a look) or are you trying to import directly from MongoDB (which I know nothing about)?
All the sessions of the conference are now available online