1

With NeDB the first statement will update the data correctly, but the second (using the doc value itself as key(and yes docs[i].ID is '2013000060') won't work - even the result of the update function tells me that 1 row was changed.

1. oDB.update({ MYID: '2013000060' }, { $set: { "PAGE": 2 }}, ...
2. oDB.update({ MYID: docs[i].ID}, {$set: {"PAGE": 2}}, ...

Some ideas?

4

3 回答 3

1

考虑到NeDB中的更新是异步工作的。

更新对象(并依赖于更新的值)后您想要做的任何事情都应该在callback您传递给.update()调用的函数内完成。

于 2015-02-28T14:46:45.033 回答
0

您能否复制粘贴您正在使用的确切代码、预期结果和实际结果?从外观上看,您似乎正在使用应该使用回调的同步代码。

于 2014-08-20T14:50:07.910 回答
0

在摆弄了 NeDB datastore.js 之后,结果发现这是一个奇怪的时间问题。该值实际上已更新,但是当发出带有查询的 .find 时,该值尚未持久化。无论如何,我没有更深入地研究使用字符串文字产生不同结果的事实。

于 2014-08-13T14:13:16.650 回答