mongodb 更新数组出现can't append to array using string field name
2015-07-03 14:32
741 查看
数据库内容大概如下:
> db.hero.update({_id:1},{$set:{"hero_list.15521.equip.4.lv":1}})
can't append to array using string field name [lv]
看了半天,原来是自己眼花,数组下标数错了
db.hero.update({_id:1},{$set:{"hero_list.15521.equip.3.lv":1}})
OK
{ _id:1, "hero_list" : { "15521" : { "stars" : 0, "_id" : 15521, "equip" : [ [ ], [ ], [ ], { "item_id" : 310141, "lv" : 103, "uuid" : "4a727ee1-e7b0-4265-b004-e2b75890378a", "amount" : 1 }, [ ], [ ] ], "lv" : 15, "exp" : 0, "quality" : 0 } } }
> db.hero.update({_id:1},{$set:{"hero_list.15521.equip.4.lv":1}})
can't append to array using string field name [lv]
看了半天,原来是自己眼花,数组下标数错了
db.hero.update({_id:1},{$set:{"hero_list.15521.equip.3.lv":1}})
OK
相关文章推荐
- MongoDB学习笔记--分组(1)
- MongoDB基本命令用
- MongoDB 副本集管理(不定时更新)
- linux 64位下的 mongodb 安装
- SQL到MongoDB映射表
- mongodb简介
- Mongodb异常关闭重启失败解决
- MongoDB初学者的配置环境和基础设施的使用
- mongodb 学习笔记 09 -- shard分片
- mongodb修改器总结
- NodeJS利用mongoose模糊查询MongoDB
- mongodb经验
- mongoDB的基本操作
- Mongodb索引
- mongodb主从复制
- MongoDB基本概念
- MongoDB集群
- MongoDB安装篇-Win7 X64
- MongoDB应用——GridFS存储文件
- mongodb常用命令