Created
December 23, 2015 11:10
-
-
Save mrm8488/041d843b924065e24a92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var User = require('route/to/models/User.js'); | |
// Find a user by his ID | |
User.findById(<here_the_id>, function (error, user) { | |
if (error) throw error; | |
console.log(user); | |
}); | |
// create a user | |
var user = new User({name: 'myusername'}); | |
user.save(function(error) { | |
if (error) throw error; | |
console.log(user saved!); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment