Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var User = require('./app/models/user');
- // create a new user called chris
- var chris = new User({
- name: 'Chris',
- username: 'sevilayha',
- password: 'password'
- });
- // call the custom method. this will just add -dude to his name
- // user will now be Chris-dude
- chris.dudify(function(err, name) {
- if (err) throw err;
- console.log('Your new name is ' + name);
- });
- // call the built-in save method to save to the database
- chris.save(function(err) {
- if (err) throw err;
- console.log('User saved successfully!');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement