Mongodb 使用模型返回集合
我刚开始使用Mongo的Sailsjs,特别是sails Mongo包,遇到了一个介绍问题,我似乎找不到任何相关文档 基本上,我有一条路线:Mongodb 使用模型返回集合,mongodb,sails.js,Mongodb,Sails.js,我刚开始使用Mongo的Sailsjs,特别是sails Mongo包,遇到了一个介绍问题,我似乎找不到任何相关文档 基本上,我有一条路线: module.exports.routes = { '/': 'PagesController.index', '/testing': 'PagesController.about' } 还有,我有一个模型网站 然后在控制器中,我执行以下操作: Websites.find().done(function(err, response){
module.exports.routes = {
'/': 'PagesController.index',
'/testing': 'PagesController.about'
}
还有,我有一个模型网站
然后在控制器中,我执行以下操作:
Websites.find().done(function(err, response){
sails.log(response);
});
mongodb: {
adapter : 'sails-mongo',
host : 'localhost',
port : 27017,
database : 'SEO'
}
这给了我以下错误:
TypeError: Websites.find(...).done is not a function
注意:在我的“connections.js”中,我有以下内容:
Websites.find().done(function(err, response){
sails.log(response);
});
mongodb: {
adapter : 'sails-mongo',
host : 'localhost',
port : 27017,
database : 'SEO'
}
你知道我哪里出了问题吗 代码中的简单bug就是这样做的 没有完成的功能。你必须运行exec