How to Connect Node.js App to MongoDB | Node.js & MongoDB Tutorial
Вставка
- Опубліковано 14 тра 2022
- Hey guys, welcome back! In this video, I will be showing you how you can connect your Node.js application to MongoDB. I'll be walking you through signing up, creating a cluster, and connecting your application to the cluster.
If you don't know what MongoDB is, MongoDB is a document-oriented database that stores data in JSON-like documents with dynamic schemas. It is most commonly used in the back-end for web applications and is the leading NoSQL database and can be used in many different ways, from a simple key-value store to a complex full-text search engine.
If you don't know what Node.js is, Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
My Website: arpanneupane.com
My GitHub: github.com/arpanneupane19
Official Express Documentation: expressjs.com/
Official Mongoose Documentation: mongoosejs.com/docs/guide.html
Code in this video: github.com/arpanneupane19/Nod...
My Programming Gear :
Keyboard: amzn.to/42vXkxh
Laptop: amzn.to/3CkAP3W
Laptop Stand: amzn.to/3X116Oi
Desk: amzn.to/43wmIEt
Monitor: amzn.to/42BAaFH
Monitor Arm: amzn.to/3NR0APS
Chair: amzn.to/42vvKAn
Desk Mat/Mousepad: amzn.to/43AhKqj
Microphone: amzn.to/45RuQ43
Headphones: amzn.to/445sf4R
#LearnToCode // #Node // #MongoDB // #Web - Наука та технологія
I struggled with this for hours, watching different tutorials but this was so straight to the point. Thanks.
Finally, someone who writes an accurate title.
Nice and efficient. Great video!
Very easy to follow along, and no time wasted! Great tutorial as always!
Thank you for your continued support!
Thanks for this man. 2nd video of yours I'm watching. The other was a beginner nodejs/Express project. This is my first MongoDB project.
Keep up the good work!
This helped me a ton after having many headaches trying to connect to mongodb by myself! Thanks!
Of course!
Such a simple and Perfect tutorial which I wanted
Took something that most people complicated and then you simplified it. Not too much explaining that's unnecessary. Great video on this!!
Thanks!!
very true. I followed along and the database connected Asap! like..I wasn't believing it ..after a watching many videos with failed attempt.
Thanks - easy steps to follow!
Very grateful Arpane you split part to be well understood by beginners
Great tutorial video, thanks!
You really nailed it! Thank you~!!!!
most helpful video I've seen
great tutorial, thanks
I love you man. Make my life so much easier
Thanks Bruh.. Helps me a lot
very helpful. thank you
thank it was very helpful
thanks bro it helps me lot
Thank you a lot Arpan^^ , great job !
Most welcome!
Great vid!
Thank you for the video idk why but this is the only video that worked for me ? Every other time it wouldn't connect? Thanks again!
Glad I could help
perfect. thanks!
Thank You soo much for making this video it is really helpful
Of course!
Would it be any different if you installed mongodb locally on your computer and used it as an application rather than through the website (cloud)?
contenido extenso y muy útil caballero. enhorabuena y gracias 👌
¡Gracias por ver!
is it mandatory to create an account? What If I just want to test my stuff locally using the ecompass from mongo and my node setup?
thank you, it worked!
You're welcome!
Even the beast approves
Best Video Ever!
Hey there what is the visual studio code theme?
thank you!
bro what is your vscode theme and font colors?
great video
thank you so much
No problem
THANK YOU
Very very Nice tutorial
Thank you! Cheers!
Bro did u use any rest Api here..?
life saver
inside one connection if I want to connect to a specific database then how am I supposed to do it??
thanks
Perfect
Thanks!
perfecto :)
Please how do I know the terminal to use
I'm quite confused on that part
Thank you, i'm connected to my Database! I tried a few times and it didnt work
While connecting to cluster why can't I see myFirstDatabase option in the connection string?
Do you mean the connection string in the video or the connecting string that's shown on the webpage?
Yeah it's different for me, too. There is no database name in my string when I copy it from the website.
@@Xxxsorrow What is the name that you chose for the database?
how can we develop a log in registration form and authenticate it ?
If you're using Node and another frontend library (React, Angular, etc), you can use JWT authentication. If you're just using Node and HTML, you can use sessions.
good
What's your keyboard and vs code theme? 😅
My keyboard is a Keychron K2 V2 Wireless Mechanical Keyboard and my color theme is the Panda Theme from VSCode Extensions.
am getting an error "URI malformed, cannot be parsed".................Please help
Error connecting to the database: MongoServerError: bad auth : authentication failed
at Connection.onMessage (C:\Users\vijay.chandhu\Desktop
ew-mern\mern-login-system-2022\server
ode_modules\mongodb\lib\cmap\connection.js:207:30)
at MessageStream. (C:\Users\v
please help ..... error :
SyntaxError: Unexpected token '.'
←[90m at Object.compileFunction (vm.js:344:18)←[39m
←[90m at wrapSafe (internal/modules/cjs/loader.js:1048:15)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1082:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:875:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:72:18)←[39m
at Object. (D:\Programming\Node JS\code\server
ode_modules\←[4mmongodb←[24m\lib\index.js:6:17)
←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m
PS D:\Programming\Node JS\code\server>
my steps is :
const express = require("express");
const mongoose = require("mongoose");
const app = express();
const uri =
"mongodb+srv://localhost:27017";
async function connect() {
try {
await mongoose.connect(uri);
console.log("Connected to MongoDB");
} catch (error) {
console.error(error);
}
}
connect();
app.listen(3000, () => {
console.log("Server started on port 3000");
});
comm sfaccimm t'am vita mij thank you so much
O sfacimm sono felice che tu ce l'abbia fatta
Hello, I can't connect with mongodb and nodejs . Please help me!
Connect chaetharno
how long have you been coding?
I believe for about 2.5 years.
@@ArpanNeupaneProductions connecting between mongobd and node il connect function wrk chaeyunillaalo y ? Ariyamo?
I guess the interface is different now, could you update
It's important not to use a public network
if you get the DeprecationWarning that means you're working in the latest mongodbversion like me so what you do is in the line inside the async function
async function connect(){
try{
mongoose.set('strictQuery', true);
await mongoose.connect(uri);
// await mongoose.connect(uri);
console.log("connected to mongoDB");
}catch(error){
console.error(error);
}
}
connect();
7:54 what? there's a part missing here
🤙
a single frame revealed your ip address
Why are you afraid of people seeing your IP... -_-
Kia aap ko urdu ni haati
Mujko Nepali, Hindi, aur Urdu aati hain.