求教:nodeclub安装后,打开主页地址出错。
发布于 12 年前 作者 tecshuttle 6799 次浏览 最后一次编辑是 8 年前

http://www.tomtalk.net:3000/

TypeError: Invalid select() argument. Must be a string or object.
    at Query.select (/usr/local/lib/node_modules/mongoose/lib/query.js:1061:11)
    at Function.find (/usr/local/lib/node_modules/mongoose/lib/model.js:863:9)
    at Object.get_all_tags (/root/tecshuttle/node.js/nodeclub/controllers/tag.js:286:7)
    at exports.index (/root/tecshuttle/node.js/nodeclub/controllers/site.js:62:12)
    at callbacks (/usr/local/lib/node_modules/express/lib/router/index.js:165:11)
    at param (/usr/local/lib/node_modules/express/lib/router/index.js:139:11)
    at pass (/usr/local/lib/node_modules/express/lib/router/index.js:146:5)
    at Router._dispatch (/usr/local/lib/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/usr/local/lib/node_modules/express/lib/router/index.js:33:10)
    at next (/usr/local/lib/node_modules/express/node_modules/connect/lib/proto.js:190:15)
15 回复

我也遇到同样的问题,lz解决了没?

解决了,是因为find()这个方法调用错误,错误总共有3出,1处在tag.js,1处在topic.js,1处在user.js,把多余的参数去除就可以了

请具体之处那几处错误好吗??

师兄能说清楚点嘛??

具体要怎样解决呢?

TypeError: Invalid select() argument. Must be a string or object. at Query.select (F:\node AND android\node_modules\mongoose\lib\query.js:1072:11) at Function.find (F:\node AND android\node_modules\mongoose\lib\model.js:874:9) at Object.get_topics_by_query (F:\node AND android\mblog\controllers\topic.js:623:9) at exports.index (F:\node AND android\mblog\controllers\site.js:79:14) at callbacks (F:\node AND android\mblog\node_modules\express\lib\router\index.js:272:11) at param (F:\node AND android\mblog\node_modules\express\lib\router\index.js:246:11) at pass (F:\node AND android\mblog\node_modules\express\lib\router\index.js:253:5) at Router._dispatch (F:\node AND android\mblog\node_modules\express\lib\router\index.js:280:5) at Object.middleware [as handle] (F:\node AND android\mblog\node_modules\express\lib\router\index.js:45:10) at next (F:\node AND android\mblog\node_modules\express\node_modules\connect\lib\http.js:204:15)

这个问题我已经解决了、、、、、、 但是又有一个错误。。。。

错误是这样的:

Error: You cannot currently mix including and excluding fields. Contact us if this is an issue. at Promise.error (F:\node AND android\mblog\node_modules\mongoose\lib\promise.js:88:38) at cb (F:\node AND android\mblog\node_modules\mongoose\lib\query.js:1473:29) at exports.tick (F:\node AND android\mblog\node_modules\mongoose\lib\utils.js:430:16) at Cursor.toArray (F:\node AND android\mblog\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cursor.js:146:30) at Cursor.each (F:\node AND android\mblog\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cursor.js:188:32) at Cursor.nextObject.self.queryRun (F:\node AND android\mblog\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cursor.js:504:39) at Cursor.close (F:\node AND android\mblog\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cursor.js:776:5) at Cursor.nextObject.commandHandler (F:\node AND android\mblog\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cursor.js:504:21) at g (events.js:192:14) at EventEmitter.emit (events.js:126:20)

请问是什么意思呢? 是我的依赖包 版本问题嘛??

有可能是版本问题

问题是由于传入参数为空值引起的,查找select()方法,把空值去掉就可以了

文件都在F:\node AND android\mblog\controllers这个文件夹下

主干是3.x版的,nodeclude用的是2.x版,一定要安装2.x版,要不会出很多错。

好久的问题了 今天我也碰到了 参数必须是对象或者字符串 把数据库查询函数find中的 [fields] <Object> optional fields to select 参数 改了就好吧 好像是老版本的是 ['xxx','xxxxx','xxxxxxx'] 这种形式的

回到顶部