-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
43 lines (39 loc) · 773 Bytes
/
init.js
File metadata and controls
43 lines (39 loc) · 773 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
const mongoose = require("mongoose");
const Chat = require("./models/chat.js");
main()
.then(() => {
console.log("Connected Succesfully!!");
return Chat.insertMany(allchats);
})
.catch((err) => {
console.err(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 : "mohit",
To : "priya",
msg : "send the notes" ,
created_at : new Date()
},
{
from : "neha",
To : "aayush",
msg : "teach me js" ,
created_at : new Date()
},
{
from : "neha",
To : "tushar",
msg : "Send me your pages" ,
created_at : new Date()
},
];