1 | /** |
||
2 | * Connect to the database and setup it with some default data. |
||
3 | */ |
||
4 | "use strict"; |
||
5 | const Model = require("./model"); |
||
6 | |||
7 | const dsn = process.env.DBWEBB_DSN || "mongodb://localhost:27017/math"; |
||
8 | |||
9 | const fs = require("fs"); |
||
10 | const path = require("path"); |
||
11 | const docs = JSON.parse(fs.readFileSync( |
||
12 | path.resolve(__dirname, "setup.json"), |
||
13 | "utf8" |
||
14 | )); |
||
15 | |||
16 | |||
17 | let model = new Model(); |
||
18 | |||
19 | // Do it. |
||
20 | model.resetCollection(dsn, "formulas", docs) |
||
21 | .catch(err => console.log(err)); |
||
0 ignored issues
–
show
Debugging Code
introduced
by
![]() |
|||
22 |