
MongoDB
afabama
随笔小心得
展开
-
Values in v:2 index key pattern cannot be of type object
Mongorestore还原遇到的问题 错误提示:Mongorestore: createIndex error: Values in v:2 index key pattern cannot be of type object. Only numbers > 0, numbers < 0, and strings are allowed 原因:导出时候的MongoDB版本和还原的版本不一致导致。导出时候用的4.2版本,导入用的4.0 解决办法:用同版本MongoDB导入即可 ...原创 2020-07-03 17:15:49 · 2476 阅读 · 0 评论 -
linux上快速的MongoDB连接和修改操作
#切换到MongoDB的bin目录 cd /etc/MongoDB/bin #进入MongoDB ./mongo #切换到业务库 use db1_prod #鉴权,登录 db.auth("user","pwd") #查看集合 show.collections; #查询业务数据 --查询id为001的用户 db.user.find({"id":"001"}) #修改业务数据--将id为001的用户姓名修改为张三 db.user.update({"id":"001"},{$set:{.原创 2020-05-22 09:14:54 · 367 阅读 · 0 评论