Created
July 30, 2011 17:51
-
-
Save raholland79/1115783 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
mongoose.connect('mongodb://localhost/lol', function(err) { | |
if (err) { console.log(err) } | |
}); | |
var ChatSchema = new Schema({ | |
name: String | |
}); | |
mongoose.model('Chat', ChatSchema); | |
var Chat = mongoose.model('Chat'); | |
var n = new Chat(); | |
n.name = "chat room"; | |
n.save(function(err,room) { | |
console.log(room.id); | |
}); | |
// run the file | |
$ node test.js | |
4e3444818cde747f02000001 | |
$ | |
mongoose 1.7.2 | |
Mongo 1.8.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment