node.js - nedb $addToSet 的坑
ringa_lee
ringa_lee 2017-04-17 13:48:08
[Node.js讨论组]

数据库如图2,目前fruits为空,我执行updae后

居然没有在原纪录的基础之上修改,,,也是醉了

附上NEDB github 地址 https://github.com/louischatriot/nedb

ringa_lee
ringa_lee

ringa_lee

全部回复(2)
大家讲道理

你是把数据库文件打开看的吧,请不要这样做。只需要按照常规的方式去读取,是会取到正确的数据的。

黄舟

这有两句话

If the document does not contain an _id field, NeDB will automatically generated one for you (a 16-characters alphanumerical string). The _id of a document, once set, cannot be modified.

Note: the _id is automatically indexed with a unique constraint, no need to call ensureIndex on it.

我觉得是_id必须是唯一的,而且最好不要自己设置,最后在update的时候,最好不要用_id为条件

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号