Repository navigation
Expand file tree
/
Copy pathinit.js
More file actions
96 lines (93 loc) · 1.67 KB
/
Copy pathinit.js
File metadata and controls
96 lines (93 loc) · 1.67 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const mongoose = require('mongoose');
const Chat = require('./models/chat.js');
main()
.then(res => {
console.log("MongoDB connected")
})
.catch(e => {
console.log(e)
})
async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/inbox')
}
let allChats = [
{
from: "nisha",
to: "prakshal",
msg: "done with api now starting with mongo",
sent_at: new Date()
},
{
from: "prakshal",
to: "nisha",
msg: "nice 👍 mongo thoda easy lagega",
sent_at: new Date()
},
{
from: "nisha",
to: "aakash",
msg: "kal ka assignment submit kiya?",
sent_at: new Date()
},
{
from: "aakash",
to: "nisha",
msg: "haan abhi just upload kiya",
sent_at: new Date()
},
{
from: "nisha",
to: "riya",
msg: "node.js samajh aa raha hai?",
sent_at: new Date()
},
{
from: "riya",
to: "nisha",
msg: "haan thoda thoda 😅",
sent_at: new Date()
},
{
from: "prakshal",
to: "aakash",
msg: "git push kiya kya?",
sent_at: new Date()
},
{
from: "aakash",
to: "prakshal",
msg: "haan repo updated hai",
sent_at: new Date()
},
{
from: "nisha",
to: "mentor",
msg: "mongodb schema clear ho gaya",
sent_at: new Date()
},
{
from: "mentor",
to: "nisha",
msg: "great 👍 ab models pe kaam karo",
sent_at: new Date()
},
{
from: "riya",
to: "prakshal",
msg: "kal meeting hai ya nahi?",
sent_at: new Date()
},
{
from: "prakshal",
to: "riya",
msg: "haan 5 baje online",
sent_at: new Date()
}
];
Chat.insertMany(allChats)
.then(r => {
console.log(r)
})
.catch(e => {
console.log(e)
})