我在这里面临一些分析瘫痪.使用NodeJS进行数据库编程的选项太多了,我有点迷失了.
I am facing some analysis paralysis here. There are so many options for programming databases with NodeJS that I am a bit lost.
我正在使用Express构建API服务器,该服务器将与移动设备上的HTML5应用程序对话.我决定使用PostgreSQL,因为我的数据是非常相关的",而PostgreSQL新的JSON数据类型将使我的生活更加轻松.
I am building an API server using Express that will talk to a HTML5 app on mobile. I decided to use PostgreSQL because my data is "very relational" and PostgreSQL new JSON data type will make my life a lot easier.
不幸的是,我找不到利用新的JSON数据类型或公开它的PostgreSQL库.我考虑过使用 Sequelize 并拥有一个不错的ORM或使用原始pgsql模块滚动自己的东西
Unfortunately, I can't find any library for PostgreSQL taking advantage of the new JSON datatype or exposing it. I thought about using Sequelize and having a nice ORM or rolling my own stuff by using the raw pgsql module.
有人可以提供线索吗?我会在一些NodeJS stackexchange上问这个问题,但我认为我们没有这么具体的问题.
Can someone shed a clue? I'd ask this on some NodeJS stackexchange but I don't think we have one as specific as this.
推荐答案我喜欢 github. com/brianc/node-postgres .它是积极开发的,只是一个很好的薄层.
I like github/brianc/node-postgres. It's actively developed, and just a nice thin layer.
要在准备好的查询中使用json类型,只需JSON.stringify您要存储为json的任何内容(这就是postgres想要的方式).
To use the json types in a prepared query, just JSON.stringify whatever you are trying to store as json (that's how postgres wants it anyway).
更多推荐
在NodeJS中使用PostgreSQL JSON类型的最佳方法是什么
发布评论