-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateJson.js
34 lines (27 loc) · 902 Bytes
/
createJson.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let config = require("./config.json");
let qm = require(config.qminer);
let fs = require('fs');
let base = new qm.Base({
mode: 'openReadOnly'
})
let tsStore = base.store("ts");
fs.writeFile('tsStoreData.json', "", (err)=>{if (err) throw err;});
console.log("writing to tsStoreData.json....")
for (var i=0; i < tsStore.length; i++){
let recJson = tsStore[i].toJSON();
recJson = { //leave out record id
Time: recJson.Time,
gayCount: recJson.gayCount,
abortionCount: recJson.abortionCount,
wallCount: recJson.wallCount,
climateChgCount: recJson.climateChgCount,
wallStCount: recJson.wallStCount,
privacyCount: recJson.privacyCount,
mexicoCount: recJson.mexicoCount
}
let recString = JSON.stringify(recJson);
fs.appendFile('tsStoreData.json', recString + "\n");
debugger
}
console.log("Finished!")
debugger