Skip to content

Instantly share code, notes, and snippets.

@hamin
Created August 21, 2011 07:21
Show Gist options
  • Save hamin/1160285 to your computer and use it in GitHub Desktop.
Save hamin/1160285 to your computer and use it in GitHub Desktop.
mongoose.coffee
Message = new Schema({content: String,nickname: String,created_at: Date})
Picture = new Schema({user: ObjectId,title: String,url: String,start_at: Date,end_at: Date,messages: [Message],created_at: Date,updated_at: Date})
PhotoAccount = new Schema({token: String,token_secret: String,provider: String,username: String,domain: String,avatar: String})
User = new Schema({token: String,token_secret: String,username: String,domain: String,avatar: String,created_at: Date,updated_at: Date,photo_accounts: [PhotoAccount]})
picture = mongoose.model('Picture', Picture)
user = mongoose.model('User', User)
picture.findOne() # { model: { [Function: model] modelName: 'Picture' }, op: 'findOne' }
@chrisdickinson
Copy link

picture.findOne(function(err, pic) { console.log(pic); })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment