I have the file "rooms.json" :
{ "name": "Computer science class 1" , "location": "Mid School upper floor"}
{ "name": "Computer science class 2" , "location": "Mid School upper floor"}
{ "name": "Computer science class 3" , "location": "Mid School upper floor"}
{ "name": "classG12N1" , "location": "High School building upper floor"}
{ "name": "classG12N2" , "location": "High School building upper floor"}
{ "name": "classG12N3" , "location": "High School building upper floor"}
{ "name": "classG12N4" , "location": "High School building upper floor"}
{ "name": "classG11N1" , "location": "High School building lower floor"}
{ "name": "classG11N2" , "location": "High School building lower floor"}
{ "name": "classG11N3" , "location": "High School building lower floor"}
Iam using mongoose in nodeJS , I need a function that will read the file , format it in json and insert into the DB .
I have tried reading the file line by line and parsing it myself but it was not efficient at all. Is there any other way?
PS , I have searched the web for another solution and yet to find .
via Zed Evans
No comments:
Post a Comment