-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
46 lines (36 loc) · 772 Bytes
/
Copy pathinit.js
File metadata and controls
46 lines (36 loc) · 772 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const mongoose = require("mongoose");
const Chat = require("./models/chat.js");
main()
.then(() => {
console.log("connection sucessfull")
}).catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/whatsapp');
}
let allchats = [
{
from:"neha",
to:"om",
msg:"send to u ",
created_at:new Date(),
},
{
from:"rishi",
to:"karan",
msg:"sentto u ",
created_at:new Date(),
},
{
from:"sai",
to:"raj",
msg:"go to u ",
created_at:new Date(),
},
{
from:"bob",
to:"adam",
msg:"1 love to u ",
created_at:new Date(),
}
]
Chat.insertMany(allchats);