Questions tagged [massivejs]

26 questions
0
votes
1 answer

How to execute transaction with massive.js

I'm trying to achieve a very simple thing: START TRANSACTION; DELETE FROM table WHERE id = 1; ROLLBACK; Running this on the postgres database works perfectly. With massive.js it doesn't: this.db.run( "START TRANSACTION", [] ); setTimeout(()…
khernik
  • 2,059
  • 2
  • 26
  • 51
0
votes
2 answers

Not able to connect to postgres using Massive.js

I am trying to connect to postgres database using massive.js. I have created a database and a table using command line in postgress now when I am trying to connect it to postgres using Massive.js I am getting error. To me it looks like I am getting…
Atul Verma
  • 361
  • 8
  • 22
0
votes
1 answer

In TypeScript, what is the best way to define a function that can return either Promise or Promise?

I'm just starting with TypeScript and I ran across a situation in which the type definitions for a library I'm using is wrong. In my case, the library is Massive,js, and here are the type definitions. The problem is that some functions should return…
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
0
votes
1 answer

Connection terminated for basic Postgres and MassiveJS

I am trying to connect to my database, but I am running into some errors. I am pretty new to all this, so sorry if I'm not being clear. I am able to use pgAdmin to run queries to my database, but I can't seem to get it working here. Here is my…
0
votes
2 answers

Node.js importing JSON to PostgreSQL

I'm trying to use Node.js to import a JSON file to PostgresSQL. I'm using massive.js to do this. Below is my JS code: var parsedJSON = require('./employeesTest.json'); var express = require("express"); var app = express(); var http =…
Jim Dover
  • 593
  • 2
  • 12
  • 30
0
votes
1 answer

Search an array using massivejs

I'm trying to construct a query on an array using massivejs, but it keeps telling me the operator is unsupported. This query works: SELECT * FROM my_table WHERE data->'items' @> '[{"foo": "bar"}]'; where data is a jsonb field and items is an array…
Joe Moore
  • 43
  • 3
0
votes
1 answer

massive-js limit columns from result

The following code returns id, title and content fields. I need only id and title. db.laws.search({columns: ["title", "content"], term: req.params.text}, function(err,laws){ res.contentType('application/json'); …
rtacconi
  • 14,317
  • 20
  • 66
  • 84
0
votes
1 answer

Getting "TypeError: db.createList is not a function"

I am currently doing a React, Express, Massivejs, postgreSql app. I am getting the error "TypeError: db.createList is not a function" anytime I'm trying to hit my post endpoint. I'm not sure how to remedy it since it looks correct. My file…
Devsterefic
  • 505
  • 1
  • 8
  • 23
0
votes
1 answer

MassiveJS strange casting error

I'm new to Massive, but I really like it. While using express.Router() and making a very simple db call: router.get('/:id', function(req, res, next) { db.accounts.find(req.params.id, function(err, results) {...}); I obtained an error: Error:…
CCPony
  • 988
  • 1
  • 7
  • 20
0
votes
1 answer

Unable to get variable from module exports

I have a connector.js file which using which I want to export dbResult object. (function(){ var Massive = require("massive"); var connectionString = "postgres://postgres:postgres@localhost/postgres"; var db = Massive.connectSync({connectionString :…
Simsons
  • 12,295
  • 42
  • 153
  • 269
0
votes
1 answer

Creating a Controller using Nodejs and massive

Using massive postgreSQL driver , I am able to connect to postgreSQL and get records from database. var Massive = require("massive"); var connectionString = "postgres://postgres:postgres@localhost/postgres"; var db =…
Simsons
  • 12,295
  • 42
  • 153
  • 269
1
2