首页 新闻 搜索 专区 学院

软件:MongoDB3.2.6;环境win10,情况:update时出错;我想问问这是不是bug

0
[已关闭问题] 关闭于 2016-05-11 14:18

整个操作过程的代码:

Microsoft Windows [版本 10.0.10586]
(c) 2015 Microsoft Corporation。保留所有权利。

C:\WINDOWS\system32>net start mongodb
MongoDB 服务正在启动 .
MongoDB 服务已经启动成功。


C:\WINDOWS\system32>E:

E:\>cd MongoDB\Server\3.2\bin

E:\MongoDB\Server\3.2\bin>mongo.exe
MongoDB shell version: 3.2.6
connecting to: test
Server has startup warnings:
2016-05-05T11:35:23.926+0800 I CONTROL  [main] ** WARNING --jsonp is specified without --httpinterface,
2016-05-05T11:35:23.926+0800 I CONTROL  [main] **         enabling http interface
> db.dogs.find()
{ "_id" : ObjectId("572aac0c25e0b96bc50f36ea"), "name" : "wang" }
{ "_id" : ObjectId("572aac1025e0b96bc50f36eb"), "name" : "li" }
{ "_id" : ObjectId("572aac3b25e0b96bc50f36ec"), "name" : "li", "age" : 1 }
> db.dogs.update({'name':'wang'},{$set:{'name':'jack'}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.dogs.update({'name':'li'},{$set{'age':9}})
2016-05-05T11:52:12.494+0800 E QUERY    [thread1] SyntaxError: missing : after property id @(shell):1:34

> db.dogs.update({'name':'li'},{$set{'name':'wangwang'}})
2016-05-05T11:52:36.569+0800 E QUERY    [thread1] SyntaxError: missing : after property id @(shell):1:34

> db.dogs.find()
{ "_id" : ObjectId("572aac0c25e0b96bc50f36ea"), "name" : "jack" }
{ "_id" : ObjectId("572aac1025e0b96bc50f36eb"), "name" : "li" }
{ "_id" : ObjectId("572aac3b25e0b96bc50f36ec"), "name" : "li", "age" : 1 }
> db.dogs.update({"name":"jack"},{$set:{"name":"think"}})
WriteResult({
        "nMatched" : 0,
        "nUpserted" : 0,
        "nModified" : 0,
        "writeError" : {
                "code" : 10003,
                "errmsg" : "Cannot change the size of a document in a capped collection: 37 != 38"
        }
})
>

第一次更新时通过,第二次更新故意写错,第三次正确更新,更新失败。

享智同行的主页 享智同行 | 菜鸟二级 | 园豆:202
提问于:2016-05-05 12:03
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册