Skip to content

Instantly share code, notes, and snippets.

@irkanu
Created April 10, 2015 22:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irkanu/493120a91bfc64f6b9bf to your computer and use it in GitHub Desktop.
Save irkanu/493120a91bfc64f6b9bf to your computer and use it in GitHub Desktop.
mongodb example for csc200
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var Cat = mongoose.model('Cat', { name: String });
var kitty = new Cat({ name: 'Zildjian' });
kitty.save(function (err) {
if (err)
console.log('meow');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment