Skip to content

Instantly share code, notes, and snippets.

@mrm8488
Created December 23, 2015 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrm8488/041d843b924065e24a92 to your computer and use it in GitHub Desktop.
Save mrm8488/041d843b924065e24a92 to your computer and use it in GitHub Desktop.
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