-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.js
56 lines (51 loc) · 1.07 KB
/
init.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const mongoose =require("mongoose");
const chat = require("./models/chat.js");
main().then(()=>{
console.log("connection successful");
}).catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/fakewhatsapp');
}
let allchats=[
{
from:"tony",
to:"peter",
msg:"get this suit",
created_at:new Date(),
},
{
from:"tony",
to:"quin",
msg:"go out of here",
created_at:new Date(),
},
{
from:"bruice",
to:"hulk",
msg:"come come come",
created_at:new Date(),
},
{
from:"captain",
to:"tchala",
msg:"i need sheild",
created_at:new Date(),
},
{
from:"tchala",
to:"bucky",
msg:"your new arm",
created_at:new Date(),
},
{
from:"tony",
to:"vision",
msg:"hack the system",
created_at:new Date(),
},
];
chat.insertMany(allchats).then((res)=>{
console.log(res);
}).catch((err)=>{
console.log(err);
});