Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created May 14, 2011 05:26
Show Gist options
  • Save ukstudio/971943 to your computer and use it in GitHub Desktop.
Save ukstudio/971943 to your computer and use it in GitHub Desktop.
require 'coffee-script'
mongoose = require 'mongoose'
mongoose.connect 'mongodb://localhost/node'
Schema = mongoose.Schema
# schema定義
UserSchema = new Schema
name : String
age : Number
User = mongoose.model('User', UserSchema)
ukstudio = new User()
ukstudio.name = 'AKAMATSU Yuki'
ukstudio.age = 24
ukstudio.save (err) ->
console.log 'save!' unless err
User.find
name : /AKAMATSU/,
(err,users) -> for user in users
console.log user.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment