이나경

Modify code for mongoDB

...@@ -18,5 +18,18 @@ var options = { ...@@ -18,5 +18,18 @@ var options = {
18 }; 18 };
19 request(options, function (error, response) { 19 request(options, function (error, response) {
20 if (error) throw new Error(error); 20 if (error) throw new Error(error);
21 - console.log(response.body);
22 -});
...\ No newline at end of file ...\ No newline at end of file
21 + var jason = response.body
22 + var json = JSON.parse(jason)
23 +
24 + const data = {}
25 +
26 + for (var i in json["rows"]){
27 + var obj = {};
28 + obj['name'] = json["rows"][i]["subjt_name"];
29 + obj['time'] = json["rows"][i]["timetable"];
30 + obj['prof'] = json["rows"][i]["teach_na"];
31 + obj['credit'] = json["rows"][i]["unit_num"];
32 + console.log(obj);
33 + }
34 +
35 +});
......