【问题标题】:mongodb,update array in collection errormongodb,更新集合错误中的数组
【发布时间】:2014-11-05 04:04:53
【问题描述】:

mongodb版本:2.6.0

收集字段:

books{
       _id,
       chatpers : [    //a book has many chatpers, so the "chatpers" is an Array.
                    { 
                        _id,
                        _parentId,
                        text
                     }
                   ]
}

我运行的查询是:

db.books.update({
    _id : ObjectId("5354725719980e913e9be3f1"),
    "chapters._id" : "93cdb3d14da841aabde0dd65aa2fa343"
}, {
    "$set" : {
        "chapters.$.text" : "5.3 Handler",
        "chapters.$._parentId" : "ef5c3f14147f417b936221db00deff38"
    }
});

问题:当章节长度很短时,效果很好。当章节长度超过120+时,mongodb报错,然后关闭:

2014-11-04T18:44:00.759-0700 DBClientCursor::init call() failed
2014-11-04T18:44:00.761-0700 Error: error doing query: failed at src/mongo/shell/collection.js:416
2014-11-04T18:44:00.765-0700 trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2014-11-04T18:44:00.766-0700 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-11-04T18:44:00.766-0700 reconnect 127.0.0.1:27017 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed

非常感谢你们的好意!

【问题讨论】:

    标签: arrays mongodb collections


    【解决方案1】:

    我的mongodb版本升级到2.6.5后,问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-10
      • 1970-01-01
      • 2019-08-10
      • 2014-11-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多