Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 猫鼬挂着,我不';没有任何连接错误_Linux_Node.js_Mongodb_Ubuntu_Mongoose - Fatal编程技术网

Linux 猫鼬挂着,我不';没有任何连接错误

Linux 猫鼬挂着,我不';没有任何连接错误,linux,node.js,mongodb,ubuntu,mongoose,Linux,Node.js,Mongodb,Ubuntu,Mongoose,我正在使用我的ubuntu,这总是挂起: router.route('/articles') // get all the articles (accessed at GET http://localhost:8080/api/articles) .get(function(req, res) { Article.find().sort('-created_at').exec(function(err, articles) {

我正在使用我的ubuntu,这总是挂起:

router.route('/articles')

    // get all the articles (accessed at GET http://localhost:8080/api/articles)
        .get(function(req, res) {
            Article.find().sort('-created_at').exec(function(err, articles) {
                if (err) 
                    res.send(err);
                res.json(articles);
            });
        });
但不仅仅是这一个,我所有的收藏似乎都是一样的,但我可以在mongo shell或Robomongo中看到它们。 我不认为这是连接错误,因为我没有:

// database
var mongoose   = require('mongoose');
console.log(config.database);
mongoose.set('debug', true);
mongoose.connect('mongodb://localhost:27017/test', function(err) {
     if (err) {
        console.err(err);
    } else {
        console.log('Connected');
    }    
});

mongoose.connection.on('error', function(err) {
     if (err) {
        console.err(err);
    } else {
        console.log('Connected');
    }    
});
不知道是否相关,但我在使用mongo shell时收到警告:

2015-09-08T19:07:12.200+0100 I控制[initandlisten] 2015-09-08T19:07:12.200+0100 I控制[initandlisten]**警告:软限制过低。RLIMIT设置为31125个进程,64000个文件。进程数应至少为32000:文件数的0.5倍

我很惊讶,因为它在几天前才起作用,我开始认为我的系统可能有问题

仅供参考我在github上的完整项目:

我整个下午都在为这个问题苦苦挣扎,什么也做不成

控制台


电话响了吗?在那里放一个console.log。对不起,是的,连接上的回调确实会触发,但没有错误。第二次回调没有。我指的是对
Article.find()
的回调,我不确定你指的是什么“第二次回调”,我以为你指的是mongoose连接的回调。不,Article.find()回调也不会启动。我也有同样的问题。你修好了吗?电话响了吗?在那里放一个console.log。对不起,是的,连接上的回调确实会触发,但没有错误。第二次回调没有。我指的是对
Article.find()
的回调,我不确定你指的是什么“第二次回调”,我以为你指的是mongoose连接的回调。不,Article.find()回调也不会启动。我也有同样的问题。你修好了吗?
   ---------$ nodemon server.js
    8 Sep 19:26:19 - [nodemon] v1.4.1
    8 Sep 19:26:19 - [nodemon] to restart at any time, enter `rs`
    8 Sep 19:26:19 - [nodemon] watching: *.*
    8 Sep 19:26:19 - [nodemon] starting `node server.js`
    mongodb://localhost:27017/test
    Listening on: 8080
    css file written on disk successfully !
    Connected
    Something is happening with the API.