简体   繁体   English

LowDB 获得价值

[英]LowDB get value

I Want to get a value from LowDB Database to make a TODO app.我想从 LowDB 数据库中获取一个值来制作一个 TODO 应用程序。 Is there way to get it?有没有办法得到它?

JSON: JSON:

{
    "content": [
        {
            "id": 0,
            "todo": "eat dinner"
        },
        {
            "id": 1,
            "todo": "wash cloths"
        }
    ]
}

I want to get the "todo" of the item with id=1 (in this example it is "wash cloths")我想获取 id=1 的项目的“待办事项”(在本例中为“洗布”)

You can do this way to get todo value where the id value is 1,您可以通过这种方式获取id值为 1 的todo值,

console.log(db.get('content').find({"id": 1}).value().todo)

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

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