-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbcreate.js
More file actions
28 lines (24 loc) · 745 Bytes
/
dbcreate.js
File metadata and controls
28 lines (24 loc) · 745 Bytes
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
const mongoose = require("mongoose");
const url = "mongodb://localhost:27017/main";
mongoose.connect(url, { useNewUrlParser: true }).catch(console.error);
const dataschema = mongoose.Schema({
details: {
refid: String,
content: String
}
});
const Delta = mongoose.model("Delta", dataschema);
(async function() {
/*dat = JSON.parse(dat);
dat.forEach(async (thing) => {
let temp = new Delta({
"details.refid": '5b63143dbed8c13284e94e83',
"details.content": thing.content
});
await temp.save().then(() => {
console.log('Success!');
}).catch(console.error);
});*/
let result = await Delta.find({ "details.refid": "5b63143dbed8c13284e94e83" }).explain("executionStats");
console.log(result);
})().catch(console.error);