-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
53 lines (49 loc) · 1.04 KB
/
init.js
File metadata and controls
53 lines (49 loc) · 1.04 KB
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
47
48
49
50
51
52
53
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/fakewhatsapp');
}
let allChats = [
{
from: "neha",
to: "priya",
msg: "Send me your exam sheets",
created_at: new Date()
},
{
from: "neha",
to: "preeti",
msg: "Send me notes for the exam",
created_at: new Date()
},
{
from: "rohit",
to: "mohit",
msg: "teach me JS callbacks",
created_at: new Date()
},
{
from: "amit",
to: "sumit",
msg: "all the best!",
created_at: new Date()
},
{
from: "anita",
to: "ramesh",
msg: "bring me some fruits",
created_at: new Date()
},
{
from: "tony",
to: "peter",
msg: "love you 3000",
created_at: new Date()
},
];
Chat.insertMany(allChats);