Files
james_endl/james_endl-js-commission/docs/lab6_materials/generate_db.js
louiscklaw cb49efbeca update,
2025-02-01 02:02:22 +08:00

18 lines
458 B
JavaScript

var conn = new Mongo();
var db = conn.getDB("lab6-db");
var topic_name = ["www", "html", "css", "javascript", "nodejs", "jquery"];
var topic_status = ["no", "no", "no", "no", "no", "no"];
var topic_hour = [2, 4, 4, 6, 10, 6];
db.topicList.remove({});
for(let i = 0; i < topic_name.length; i++){
db.topicList.insert(
{
'name': topic_name[i],
'hour': topic_hour[i],
'status': topic_status[i]
}
)
}