简体   繁体   English

如何使用NeDB更新数据库中的记录?

[英]How to update a record in database using NeDB?

I have created a database to store details of people. 我创建了一个数据库来存储人员详细信息。 I have a record like: 我有类似的记录:

   {"Name":"moon","Email":"night","User":"sun","Password":"earth","_id":"kpOBxczJlr2R5S68"}

How do change the password from 'earth' to 'mars'?? 如何将密码从“地球”更改为“火星”? How do I use the db.update() in NeDB to make this change?? 如何在NeDB中使用db.update()进行更改?

Doesn't the way explained in the docs work for you? 文档中说明的方式对您有用吗? For example: 例如:

db.update({ _id: 'kpOBxczJlr2R5S68 }, { password: 'mars' }, {}, (err, num) => {
  // ...
});

What have you tried so far? 你试过什么了? Did you try the examples from the documentation? 您是否尝试过文档中的示例?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM