Created
          May 14, 2011 05:26 
        
      - 
      
- 
        Save ukstudio/971943 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
    
  
  
    
  | 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