Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (25 sloc) 0.749 kb
mongoose = require('mongoose')
#db = mongoose.connect('mongodb://localhost/nodepad')
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
# Models are defined through the Schema interface
documentSchema = new Schema {
'user_id' : ObjectId,
'title' : {type : String,index : true},
'data' : String,
'tags' : [String]
}
exports.Document = mongoose.model 'Document',documentSchema
# defining Document as model
# not sure this is required or not
# not sure whether I need to use export or not
#mongoose.model 'Document',Document
#exports.Document = mongoose.model 'Document'
###
mongoose.model('Document', {
properties: ['title','data','tags'],
indexes: [ 'title']
})
exports.Document = (db)->
db.model('Document')
###
Jump to Line
Something went wrong with that request. Please try again.