1
vote
1answer
34 views

Loose request outside of an expired connection

I am trying to perform the following pg-promise query, but receive this error: Loose request outside of an expired connection The query actually succeeds, but, even so, I would like to get rid of ...
-1
votes
0answers
32 views

Nodejs cannot send header after they are send

I already read many questions related to this topic, but every answer just say that i should put a return statement so it doesn't send 2 responses. I understand that, but i keep getting the same ...
0
votes
0answers
11 views

Error: Warning: Possible EventEmitter memory leak detected

While running test I got warning using Postgresql. Warning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added. Use emitter.setMaxListeners() to increase limit.
0
votes
2answers
26 views

Knexjs PgSQL json query

I have a column in a Postgres that stores some JSON data. The JSON has no defined schema, but it should be possible to search all records that have some specified key. I'm using KnexJS to build the ...
1
vote
1answer
30 views

Database design for kids chore schema

I'm wondering about best practise to keep a database as tidy as possible. The database is postgresql accessed by express.js/node. It is for a kids chores app that I'm working on and it has the ...
0
votes
0answers
14 views

Connection Terminated when querying postgres

I am unable to query my database using pg. I am ssh'd to a remote machine(where the DB is) running Ubuntu, the same as my machine, and hosting a server using express to display the information i get ...
0
votes
1answer
22 views

upload a file and obtain its file name and save it to database that is in pgsql

in index.js file i have given router.post('/postfileupload',User.postFileUpload,function(req,res,next){ User.postFileUpload(req,res); }); and in user.js I have provided the function definition ...
0
votes
0answers
24 views

Sequelize findOrCreate generates two rows

I'm using Sequelize on a Postgresql database and I run the following query: let idUser = req.user.idUser; db.table.findOrCreate( { where : { idUser : idUser }}).spread(function (data, created) { ...
0
votes
1answer
17 views

How to connect to postgresql locally with node.js on Ubuntu 16.04?

Soo I am using Digitalocean droplet and used this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04 to set it up. The postgres works on the ...
2
votes
2answers
46 views

PostgreSQL RETURNING fails with REGEXP_REPLACE

I'm running PostgreSQL 9.4 and are inserting a lot of records into my database. I use the RETURNING clause for further use after an insert. When I simply run: ... RETURNING my_car, brand, color, ...
0
votes
0answers
98 views

Return value from promise is undefined Node.Js

I'm using ubus to communicate with physical devides and I'm trying to set a configuration and then use that result to commit to a file (write) inside the device but i always get undefined from the uci ...
0
votes
0answers
14 views

Not update properly in update sequelize in nodejs

please let me know why some records are not updated properly. Shall I add promises(bluebird) in following statement? If yes, please let me know how to add it. Thanks in advance. companies.forEach(...
0
votes
1answer
21 views

bookshelf orderBy ignore case

I am trying to order my collection fetch results by a column which is working so far, but I want the sorting to be case insensitive. I've gone through the bookshelf docs and searched around here and ...
1
vote
0answers
13 views

Getting data populated from queries (with sequelize) in both ways?

I'm starting to work with sequelize (I'm pretty happy about it), but I still don't get how to work with field "population" (this term comes from mongo, I'm sorry :( ) Here's my model definition: ...
-3
votes
1answer
14 views

Sequelize perform a raw query

I am trying to perform a raw query on my model, but I don't get any result for it. When I point to a specific route on my server I want my model to perform a raw query because the query is more ...
0
votes
1answer
12 views

Sequelize how to join 2 tables 1:N

I have 2 models: User and Foto Each User has a lot of fotos, and each foto can have just 1 user related. To do that i use include, the problem is, i can use the include just when i am querying the ...
0
votes
1answer
21 views

NodeJs DataPumps with PostgreSQL: Process Hangs

Hi I started learning node.js three days ago and i have been trying to use datapumps. So far I am running node js with Express and the problem is that my process function never runs. I see this ...
0
votes
0answers
17 views

get object in a 1 to many relationship

I have 2 models: User and Foto. 1 User can have a lot of fotos, and each foto is related to 1 specific user. So at the moment i need to get all the fotos, and for each foto get the specific user too(...
0
votes
0answers
21 views

Get specific user in a 1 to many relationship

I have two models in my database: User and Foto A user can take many fotos, and a foto is related to 1 specific user, so i have a 1 to many relationship. What i try to archive is, get all fotos and ...
0
votes
0answers
12 views

eager loading 1 to many relationship fail

I am trying to do a simple eager loading relationship betweem two tables: User and Foto. Each User shoukd have a lot of Fotos, and each Foto is associate to 1 specific user, I already could eager ...
0
votes
0answers
20 views

Sequelize 1:N no association found

I have 2 models: User and Foto where each User can have N Fotos and each Foto is assciate with 1 User. So what i need is to eager load the Foto(i pass a specific id to retrive the foto) and the user ...
0
votes
0answers
25 views

Angularjs data column with one hour less than database

Hy everyone i'm trying to show a expire_data field of my database with the value "2017-06-01 11:42:00" but in the browser appears "01-06-2017 10:42:26" Why is this happening? To insert in bd I'm ...
0
votes
1answer
22 views

Sequelize join data in tree

I have 3 models that work like a tree: Plants, Genre and family. Each family can have a lot of genres each genre is associated to 1 family. Same for Genre, each 1 can have a lot of plants and 1 ...
0
votes
2answers
33 views

where: “raw query” has been removed, please use where [“raw query”, [replacements]]

Unhandled rejection Error: where: "raw query" has been removed, please use where ["raw query", [replacements]] I've encountered following above message when I've rendered following code. Because it'...
0
votes
0answers
18 views

Sequelize assocation get count without query

I have this two models: Genre module.exports = function (sequelize, DataTypes) { var Genre = sequelize.define("Genre", { name: { type: DataTypes.STRING, ...
0
votes
0answers
18 views

ST_DumpAsPolygons from png

I have several png files with polygons that I get via http request. I'd like to vectorize that polygons. Firstly, png file can contain several polygons, that means that this is multipolygon, or ...
0
votes
0answers
22 views

Update from bd with success but returns undefined on Controller Node.Js

Hy everyone, I'm having some troubles with my rest api. I have in my ui a button where I click to update the state of a bus ( visible / not visible). By clicking on the button I can update the state ...
1
vote
2answers
53 views

Node.js - PostgresSQL - could not determine data type of parameter $1 error

I'm trying to create a PostgreSQL prepared statement using node.js pg npm package. However, I keep getting an error: could not determine data type of parameter $1 function promiseQuery(sql, ...
2
votes
1answer
38 views

Knex:Error Pool2 - Error: The server does not support SSL connections

Trying to connect with Postgres Node js and ran into the error Resource Wall is listening on port 8080 Knex:Error Pool2 - Error: The server does not support SSL connections Knex:Error Pool2 - Error:...
0
votes
0answers
30 views

variable value becomes undefined in NodeJS after if cycle

HI I have some code to get a json value from my db and then add it to an object but in my if cycle it has the value {"isRoot": "true", "visible": "true"} but after the cycle i do a console.log to ...
0
votes
0answers
12 views

nodejs not connects to postgresql on docker-compose containers

I am having problems connecting to my postgresql database using nodejs. I have all mounted with docker-compose. version: "2" services: server: build: . ports: - "5000:5000" ...
0
votes
0answers
17 views

Sequelize set grometric point on model

I am working with sequelize/NodeJS, and I need to have a geomtric field in my model(Point), I can't figure out how to use it. At the moment I have this: position: { type: DataTypes.GEOMETRY('Point'...
0
votes
2answers
79 views

Mocking database when testing microservice functions

I have created a basic NodeJS micro-service with pg-promise. I have created the routing file (index.js) containing the APIs via express: var express = require('express'); var router = express.Router()...
1
vote
2answers
23 views

Postgred pg_notify/listen only working if channel name is lower case

I've read https://www.postgresql.org/docs/9.6/static/sql-notify.html and the channel name is just described as an 'identifier'. I'm using NodeJS and pg https://www.npmjs.com/package/pg to access ...
1
vote
1answer
23 views

Return all values if parameter is NULL using SQL?

I am not sure what is the right way to do this. I basically want to return all values if value for certain filter is not defined. Get request is made with filters like this: url.com?filter1=abc&...
0
votes
1answer
39 views

Adonis.js search queries

I'm trying to find a way to execute a search query using adonis.js but I cannot find any way to do this with Lucid ORM... I'm currently using this, but it's clearly not the right way to make a search ...
0
votes
0answers
35 views

How to get sub query columns in main query with WHERE EXISTS in PostgreSQL?

I am stuck with a query which takes more time in JOIN, I want to use WHERE EXISTS in place of JOIN since as performance wise EXISTS takes less time than it. I have modified the query and it's ...
2
votes
5answers
74 views

Node.js - How to chain Promise in The right way

I recently moved from callback functions to promises in node.js. I want to preform async query to the DB (psql) in the most elegant way. I was wondering if the following code is the right way to do it ...
0
votes
1answer
15 views

Error connection to server: FATAL: role 'postgres' does not exist

I've found that error when I connect postgres database with pgAdmin3. And I thought postgres username is lost but I've tried psql -l in terminal then I found postgres username still exist. ...
0
votes
1answer
25 views

Node.js async module value return

I'm struggling to grasp how to use asynchronous programming. I have a tcp server that listens for connections, accepts packets, then passes the contained data to a module that generates keypairs and ...
2
votes
2answers
45 views

RXJS PostgreSQL backpressure in nodejs

Original title: How to slow down PgSQL results rows stream in javascript? I'm experiencing out of memory issue in nodejs v4.5.0 with RXJS(5.4.0) and PostgreSQL (driver "pg": "6.1.4"). I manually ...
0
votes
1answer
22 views

Node.js: initiate pg.Pool()

As per example (db.js) const pg = require('pg'); const client_config = {...}; const pool = new pg.Pool(client_config); pool.on('error', function(err, client) { console.error('idle client error'...
1
vote
1answer
22 views

Using sequelize to make an API with hasMany relationship postgresql

I am using sequilize on top of node.js and express in order to create an API that my react can access using this tutorial http://mherman.org/blog/2015/10/22/node-postgres-sequelize/#.WSJ77BMrLBL. I ...
1
vote
1answer
31 views

Sequelize increment function returning error

Trying to increment an integer field on a model instance in my DB. Here is the relevant code. models.Options.findAll({ where: { PollId: poll_id, name: ...
0
votes
2answers
19 views

Getter method not working on PostgreSQL model

I am defining a getter method on my Users model like so, 'use strict'; module.exports = function(sequelize, DataTypes) { var Users = sequelize.define('Users', { name: DataTypes.STRING, ...
0
votes
1answer
56 views

Get executed SQL statement from pgPromise query result

I'm writing an API that does queries over multiple postgres databases using node and pg-promise. I'm interested in getting the executed SQL statement from query result. Something like pg-monitor ...
0
votes
0answers
26 views

Elasticsearch jdbc-importer in Nodejs and postgresql

I want to use Elasticsearch within my project. I am using Nodejs and postgresql. I want to connect postgresql with elasticsearch for this i am using jdbc-importer. I followed the steps written in ...
0
votes
0answers
35 views

What is the best structure for a chat pub-sub? (PubSub server agnostic)

Hey guys so just so I'm using PostgreSQL with my server already so I thought I would use its PubSub capabilities with NOTIFY. I was wondering what would be the best way to publish chat messages? I ...
0
votes
1answer
28 views

SequelizeJS HasOne association error

I am relatively new to NodeJS and SequelizeJS and am facing a hasOne issue with a query I am building and I'd like to know your thoughts about this issue to find out where I gone wrong and the correct ...
1
vote
0answers
49 views

Fetch multiple Refcursor in node js from postgres db (using pg-promise)

I need to fetch multiple cursors from pg functions in Nodejs. I have tried both kinds of function writing methods in PG as said in below link: http://www.sqlines.com/postgresql/how-to/...