-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
39 lines (34 loc) · 803 Bytes
/
init.js
File metadata and controls
39 lines (34 loc) · 803 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
const mongoose = require("mongoose");
const Chat = require("./models/chat");
main().then(() => {
console.log("Connection successful");
}).catch((e) => {
console.log(e);
})
async function main() {
await mongoose.connect("mongodb://127.0.0.1:27017/fakewhatsapp")
}
let allChats = [
{
from: "Gautam",
message: "Kya haal he bhai",
to: "Gaurva Kumar"
},{
from: "Aditya",
message: "Hello, Brother",
to: "Gautam"
},{
from: "Ankush",
message: "Bhai kal college aayega...",
to: "Gautam"
},{
from: "Gourav",
message: "Hlw, how are you",
to: "Akansha"
},{
from: "Harsh",
message: "Give me your notes bruhh",
to: "Rajat"
}
]
Chat.insertMany( allChats);