简体   繁体   English

NodeJS中数据库的解决方案是什么

[英]What is your solution to database in NodeJS

I am interesting in implementation a database in NodeJS, however I don't want to use any frameworks or packages but build in. I completely understand that async read file is not a good solution.我对在 NodeJS 中实现数据库很感兴趣,但是我不想使用任何框架或包而是内置。我完全理解异步读取文件不是一个好的解决方案。 Is there any good method to read a required value of a key from .json file without reading it all or keeping in ram all the time?有没有什么好的方法可以从 .json 文件中读取所需的键值,而无需全部读取或一直保存在 ram 中? What is your way to deal with that?你有什么办法来处理? Or there is no solution in NodeJS for this purposes?或者 NodeJS 中没有用于此目的的解决方案? Thanks for the answers.感谢您的回答。

So I tried async read file, but that is very time/resource heavy solution.所以我尝试了异步读取文件,但这是非常耗时/资源繁重的解决方案。

您可以使用require('./filename.json')来获取对象,而不是异步读取文件。

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

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