哪个是与 node.js (express.js) 一起使用的最佳数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48374474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:39:31  来源:igfitidea点击:

Which is the best database to use with node.js (express.js)

node.jsdatabaseexpress

提问by Sohomdeep Paul

Which is the best database to use with node.js (express.js)

哪个是与 node.js (express.js) 一起使用的最佳数据库

  • Cassandra
  • Couchbase
  • CouchDB
  • LevelDB
  • MySQL
  • MongoDB
  • Neo4j
  • Oracle
  • PostgreSQL
  • Redis
  • SQL Server
  • SQLite
  • ElasticSearch
  • 卡桑德拉
  • 沙发底座
  • 沙发数据库
  • 级别数据库
  • MySQL
  • MongoDB
  • Neo4j
  • 甲骨文
  • PostgreSQL
  • Redis
  • 数据库服务器
  • SQLite
  • 弹性搜索

Please suggest any one.

请推荐任何一个。

回答by VocoJax

Redis is an in-memory database. So it doesn't really fit into the list. Redis is great for storing web tokens (for example) and anything else that doesn't necessarily need to be preserved between reboots. If you want insanely fast query times and don't care if the data is saved to disk, choose this guy. I'm currently building an MMO where a key (auth token) and the value (position, username, etc.) is stored in Redis. This allows for insanely fast position updates.

Redis 是一个内存数据库。所以它真的不适合列表。Redis 非常适合存储 Web 令牌(例如)以及在重新启动之间不一定需要保留的任何其他内容。如果您想要非常快的查询时间并且不关心数据是否保存到磁盘,请选择这个人。我目前正在构建一个 MMO,其中密钥(身份验证令牌)和值(位置、用户名等)存储在 Redis 中。这允许疯狂快速的位置更新。

When choosing a database, it doesn't really matter which one you choose unless there is a database that advertises a specific advantage that you need. Usually, those advantages and disadvantages are advertised very clearly on the database documentation and you should read up on these differences.

选择数据库时,选择哪个并不重要,除非有一个数据库可以宣传您需要的特定优势。通常,这些优点和缺点在数据库文档中非常清楚地宣传,您应该仔细阅读这些差异。

Additionally, most databases communicate via a network protocol of some sort. So integrating with any language, whether it be Node.js, Java, Rust, C++, Python, or Perl should be fairly straight forward (if not already done for you). That being said, there are really nice packages in NPM for wrappers around specific database.

此外,大多数数据库通过某种网络协议进行通信。因此,与任何语言的集成,无论是 Node.js、Java、Rust、C++、Python 还是 Perl,都应该是相当直接的(如果还没有为您完成)。话虽如此,NPM 中有非常好的包用于特定数据库的包装器。

For instance, MongoDB fits beautifully with Node.js with a great wrapper package called 'mongoose'. However, MongoDB is optimized for fast single queries and small document sizes of 16MB maximum. If you are building a file storing app, and want to store user's large files, MongoDB probably isn't your best choice.

例如,MongoDB 与 Node.js 完美契合,带有一个名为“mongoose”的出色包装包。但是,MongoDB 针对快速单个查询和最大 16MB 的小文档大小进行了优化。如果您正在构建一个文件存储应用程序,并且想要存储用户的大文件,那么 MongoDB 可能不是您的最佳选择。

If you want a database that has literal decades of development and community with instant google searches for documentation, use an SQL database (MYSQL, PostgreSQL, SQLite). SQL has been around forever and can be modified to do just about anything you want. In NPM, 'pg' is a really solid lib.

如果您想要一个拥有数十年发展和社区以及即时 google 搜索文档的数据库,请使用 SQL 数据库(MYSQL、PostgreSQL、SQLite)。SQL 一直存在并且可以修改以执行您想要的任何操作。在 NPM 中,'pg' 是一个非常可靠的库。

Images are also not something that is typically stored on databases either. So you might not need a database at all! Using something like Amazon S3 to store images or just a Linux file structure is about all you will need. The NPM package 'aws-sdk' has an S3 library that is SUPER solid. For a file system, you can just use the built in 'fs' library.

图像也不是通常存储在数据库中的东西。所以你可能根本不需要数据库!使用 Amazon S3 之类的东西来存储图像或仅使用 Linux 文件结构就足够了。NPM 包“aws-sdk”有一个非常可靠的 S3 库。对于文件系统,您可以只使用内置的“fs”库。

For kicks and giggles, for a really specific database, check out my in-development database for USB devices at: https://github.com/Hymanmead515/jsmdatabase

对于踢球和傻笑,对于真正特定的数据库,请查看我正在开发的 USB 设备数据库:https: //github.com/Hymanmead515/jsmdatabase

回答by saiz

you can use these databases with node.js and express.js MongoDB. Neo4j. Oracle. PostgreSQL. Redis. SQL Server. SQLite. cassandra. couchDB ElasticSearch. most preferred one is mongo and sql

您可以将这些数据库与 node.js 和 express.js MongoDB 一起使用。Neo4j。甲骨文。PostgreSQL。Redis。SQL 服务器。SQLite。卡桑德拉。沙发数据库弹性搜索。最喜欢的一个是 mongo 和 sql

回答by deepak thomas

All the above DB are good, it depends on what use case that you need it for. For most of the occasion mongoDb will do the trick for backend and it is scalable and elasticsearch for search oriented systems.

以上所有数据库都很好,这取决于您需要它的用例。在大多数情况下,mongoDb 会为后端解决问题,它是面向搜索的系统的可扩展和弹性搜索。

回答by Rodrigo

How about realm database? I've seen quite a lot of use for mobile database and I'm not sure if it's good for node.js or not.

领域数据库怎么样?我已经看到很多移动数据库的用途,但我不确定它是否适用于 node.js。