Join Alexander Zanfir for an in-depth discussion in this video Save to Mongo from the endpoint, part of MEAN Stack and MongoDB: Development Techniques.
- [Voiceover] There are two popular choices…to get Mongo working with Node.js,…Mongoose and the official MongoDB driver.…I will be using the official MongoDb driver to start with,…since it's simpler and Mongoose is built on top of it.…Let's begin by installing MongoDB with NPM.…So back in our backend Command Prompt,…let's use NPM install MongoDB,…and I won't be using the Save command…because we're not going to using MongoDB.…Once we deploy, we'll be switching to Mongoose by then.…
Next, let's go back to brackets and open up our server.…Let's require it into our server.…And we need to specify .MongoClient,…and then we can connect to our MongoDB…using the Connect function.…So I'll type in mongo.connect…and I'll pass on our URL,…which will be mongodb://localhost…and then the port we saw earlier for MongoDB,…which is two seven zero one seven…and then slash our database name, which is test.…
Now, let's pass on the callback into the second parameter,…and the first argument will give us an error,…and the second will give us a reference to the database.…
- Installing and setting up your MEAN toolset
- Making an Angular post form
- Sending posts
- Displaying messages
- Creating a registration form
- Saving users
- Associating users with posts
- Authenticating users at login
Skill Level Intermediate
2. Message Posting
3. Display Messages
Save a user with Mongo13m 26s
5. Logging In
Next steps2m 5s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.