2012-06-09 124 views
0

我是新來的node.js和mongo db。我所試圖做的是調用命令函數從index.js我model.js但我有一個抱怨找不到方法錯誤

目標函數模型()沒有下令方法()

路線/index.js

var pics_ = models.Picture.ordered(); 

model.js

Picture.prototype.ordered = function() { 
var ordered = mongoose.Picture.find().sort({points:-1}).toArray() 
console.log(ordered); 
return ordered; 
}; 
+0

您是否在model.js中導出圖片對象? –

+0

是的。我是var Picture = mongoose.model('Picture',PictureSchema); exports.Picture = Picture; – LivingThing

回答