Join Alexander Zanfir for an in-depth discussion in this video Save a user with Mongo, part of MEAN Stack and MongoDB: Development Techniques.
- [Voiceover] Now that we are receiving the new user info,…we can start saving it to mongo,…and to do that the first thing we'll need to do…is create a User model for mongoose.…But since our server.js is getting a bit crowded,…before we add the model, let's create a folder…where we will be putting our models, called models.…Now let's create a new script called Message.js.…And let's copy and paste our Message model from server.…And actually I'll cut it since we no longer need it here.…
And instead of setting it to a variable, let's export it,…so we'll use module.exports.…We will also need to require in mongoose…since we use it in the script.…So I'll go back to our server and copy that.…Next let's go back to our server…and import our new Message model.…And that's inside our models folder…and we can use a lowercase m for message.…
Now if we run our node app, we should get no errors.…And so far so good.…Next let's create our User model.…We will require in mongoose…and then export the User mongoose model.…But first let's start with the file.…
- 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.