-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
39 lines (35 loc) · 718 Bytes
/
init.js
File metadata and controls
39 lines (35 loc) · 718 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
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/whatsapp');
}
let allChats=([{
from:"neha",
to:"priya",
msg:"send me your exam sheets",
created_at:new Date(),
},
{
from:"tiya",
to:"riya",
msg:"send me your note sheets",
created_at:new Date(),
},
{
from:"ruhi",
to:"ali",
msg:"send me your xerox sheets",
created_at:new Date(),
},
{
from:"tina",
to:"rinki",
msg:"send me your cheat sheets",
created_at:new Date(),
}
]);
Chat.insertMany(allChats);