-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
37 lines (34 loc) · 899 Bytes
/
init.js
File metadata and controls
37 lines (34 loc) · 899 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
const mongoose = require("mongoose");
const Chat = require("/Users/shobhitchandra/Documents/WebDev/chatbot - mongoose/models/chat.js");
main().then(() => {
console.log("Working");
}).catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/chatbot');
}
Chat.insertMany([
{
from: "Priya",
to: "Aman",
message: "Hey Aman, did you complete the assignment?",
created_at: new Date(),
},
{
from: "Neha",
to: "Rohit",
message: "Happy Birthday Rohit! 🎉",
created_at: new Date(),
},
{
from: "Ankit",
to: "Meera",
message: "Are you coming to the meeting?",
created_at: new Date(),
},
{
from: "Meera",
to: "Ankit",
message: "Yes, I’ll be there by 11 AM.",
created_at: new Date(),
},
])