数据库如图2,目前fruits为空,我执行updae后
居然没有在原纪录的基础之上修改,,,也是醉了
附上NEDB github 地址 https://github.com/louischatriot/nedb
这有两句话
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为条件
你是把数据库文件打开看的吧,请不要这样做。只需要按照常规的方式去读取,是会取到正确的数据的。