【发布时间】:2011-11-17 05:04:10
【问题描述】:
我的locationsModel 文件:
mongoose = require 'mongoose'
threeTaps = require '../modules/threeTaps'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
LocationSchema =
latitude: String
longitude: String
locationText: String
Location = new Schema LocationSchema
Location.methods.testFunc = (callback) ->
console.log 'in test'
mongoose.model('Location', Location);
要调用它,我正在使用:
myLocation.testFunc {locationText: locationText}, (err, results) ->
但我得到一个错误:
TypeError: Object function model() {
Model.apply(this, arguments);
} has no method 'testFunc'
【问题讨论】:
标签: javascript node.js mongodb coffeescript mongoose