2017-02-06 12 views
0

を表現+ファンクションマングース+ nodejsではありません私はマングースで見つけるを行うにしようとしていますが、私はこの.findが

"TypeError: Query.find is not a function"

は、私はこのモデル持ってもらう:

// file: ./models/request.js 

var mongoose = require('mongoose'), 
    Schema = mongoose.Schema; 

var dnSchema = new Schema({ 
    customerId: String, 
    uuid: String, 
    get_data: String, 
    get_scores: String 
}); 

dnSchema.index({ customerId: 1, time: -1 }); 

module.exports = mongoose.model('dN', dnSchema); 

を私は持っていますこのコントローラ

var mongoose = require('mongoose'); 
var dn = mongoose.model('dn'); 

(...) 
var getScores = exports.getScores = function(req, res) { 
var Query = new dn(); 
console.log(Query) 
Query.find({}, function(err, example) { 
    res.status(200).send(example) 
}); 
} 

そして、これは

をindex.js

私は単純な.findをやろうとしていますが、できます。

私はあなたの仲間を願っています!

ありがとうございます!

+0

は 'mongoose.model( 'DN')'それはちょうど、資本問題がある可能性があります –

答えて

0

コントローラにスキーマをインポートして、それを使用してみてください。私はあなたのモデル `mongoose.model( 'dNの'、dnSchema)`にして、コントローラに表示

​​