Can we use parse server for postgresql - node.js

Currently I am using MongoDB with parse-server as back-end in my node.js application, because of business requirement I have to change my database from mongodb to postgresql. Is there any way by which I can use parse-server with postgresql?

Yes, it is possible. Just make use of the Postgres adapter. Only downside is the documentation is lacking. The adapter however has passed most of the tests.
https://github.com/ParsePlatform/parse-server/tree/deedf7b370a8b133d5b8573369e1058973616ef1/src/Adapters/Storage/Postgres

Related

Inserting into database with NodeJS

How does one use a NodeJS back-end to execute a function then store that value into a database?
A popular approach is to combine Node.JS (as a REST API back-end server) with MongoDB (a NoSQL database system). The Node.JS application exposes a series of endpoints for the outer world to interact with (e.g. create user, delete user, update user's preferences, etc.) and, under the hood, each endpoint has its own business logic, related to its scope.
Check out this guide for more.
A common approach is to use a ORM in case of relational databases, two popular ORM in node.js ecosystem are sequelize and TypeORM, in case of databases like MongoDB you can use a ODM a popular library is mongoose
There is a lot of tutorials in the web this one of my favorites one using: Node, Express (Web Server) and MongoDB

How can I decide if I should use a NoSQL vs a SQL database engine?

I plan to build an app using Node.js as my Rest API Service and Angular for my Admin side.
I've tried to create Rest API using Node.js with MongoDB as my database server.
MongoDB is a transactional DB, not a relational DB. So my question is, is MongoDB not good as my database server because it's a transactional DB? (for storing all data let's say data for e-commerce)? How can I know which one to use, MongoDB or a regular SQL database.
Thanks for your answer.
You have a couple of concepts wrong.
First, Angular is a frontend framework not a backend. Angular runs in the browser. Perhaps you mean you will use as your "admin" panel or whatever but it's a frontend technology. It will need to talk to an API server, which is the backend part.
Second, database engine selection is chosen depending on the system non-functional requirements. There are plenty of articles you can research so that you can make the decision, such as this one from MongoDB official site. There's also a video on it too.

How do couchdb curl commands translate to nano or node's http library?

Trying to use pouchdb and couchdb in a new app I’m building for a client and I’m getting desperate after struggling with what I assume are some of the most basic things. All instructions I find on couchdb are using curl commands and I can’t seem to be able to translate them into my application code. I’m using nodejs and express.
Specifically I'm struggling with these two questions, but a more general instruction on how translate curl instructions into my node app would probably be most helpful if it is possible.
How do I add a _security document with a member role to a database with nano or node’s http?
How do I add a role to an existing user with nano or node’s http?
The PouchDB API is very easy to use. Most of the term used for PouchDB are similar to CouchDB.
As some of the feature of CouchDB are not implemented in the core PouchDB, some plugin exists.
For example, to use the _security : https://github.com/pouchdb/pouchdb-security

DB-agnostic Node.js code

I have some node.js code that connects to CouchDB and now I'm exploring other NoSQL databases (DynamoDB, MongoDB, etc).
Is there a DB-agnostic module that would allow me to switch NoSQL databases without much trouble?
For sure you will need to change your code to adapt to a new database.
Anyways, there are a few options that allow you to switch from one of other database easily.
If you consider building from scratch, Loopback has a juggler that allows to setup each model to connect to a different database. If you want to include it as a module in your app. probably you are looking something like Waterline.
I have only used Loopback, it's great.
I haven't used Waterline.

How can I connect my Node.js application to MongoDB without using native modules?

We can accept 20 times slower to avoid using python or C++ in our project. Are there a native module that still works?
There is no need to invent wheel. mongodb package is the simplest one
But if You insist there are many ways:
Easy way: You can use Rest API of mongo and do requests to it using request package
Moderate way: Open mongodb-core package and copy out what You need most, make Your own mongodb class.
Moderate way #2: fork mongodb package, manipulate it and save with new repository name
Hard way: If You want go hardcore (: read mongodb protocol and operate with it using net package to open socket connection to mongodb server.
How about Crest? It's a node wrapper around the MongoDB server that provides a REST API. With it you could talk to MongoDB over REST instead of with a native client, similar to CouchDB.
There are some other utilities listed here. Maybe you're okay with using Python outside of your app but in front of MongoDB to provide the REST API? If so then maybe those are some alternatives if you don't like Crest. Haven't used it myself so I can't vouch for its quality, but it is listed on MongoDB's own list so hopefully it's decent.

Resources