-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.js
45 lines (42 loc) · 945 Bytes
/
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
const mongoose = require("mongoose");
const Chat = require("./models/chat.js");
main()
.then(()=>{
console.log("connection succesful");
})
.catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/whatsapp');
}
Chat.insertMany([
{
from : "akshay",
to: "suman",
message: "I have a doubt in JS , can you help?",
created_at: new Date()
},
{
from : "rohit",
to: "mohit",
message: "Plz teach me JS callbacks",
created_at: new Date()
},
{
from : "amit",
to: "sumit",
message: "All the best!",
created_at: new Date()
},
{
from : "anita",
to: "ramesh",
message: "Hi, are you fine?",
created_at: new Date()
},
{
from : "tony",
to: "peter",
message: "Love you 3000",
created_at: new Date()
},
]);