I have to execute an INSERT INTO query using mysql or mysql2 in node.js The values passed into the query utilizes a spatial geometry function ST_GeomFromGeoJSON() on geoMap column which is of type GEOMETRY. Here is the simplified code: The above code does not work and throws the error Cannot get geometry object from data you send to the GEOMETRY
Tag: node.js
Sequelize: Avoid Race Condition When Updating Field with Unique Value?
I have a field in my postgres db called authorizedUserNumber. This field is set by default to 0, and does not auto-increment, because it is only asigned when a user has been fully onboarded. Okay, so let’s say a new user has been fully onboarded and I want to assign a unique number to the field authorizedUserNumber. In the event
Node.js rounds my sql result. how do i prevent this?
I am requesting a bigint from my database. However, Node.js alters the value of my request, so that my program doesn’t work. Here’s my code: The console logs: However, if i run the same statement in PHPmyAdmin, it looks like the following: it returns: Why does Node.JS round the value up and how do i prevent it? Answer This happens
How to use a SQL Result in Discord.JS SelectMenus?
I am trying to add Options to a SelectMenu from a SQL request. My code is the following: My Console is giving me the following output: There are no Errors. Still Discord doesn’t add it. It looks like this: Discord View of the Select Menu I have no clue, what i did wrong. Please help me out. Thanks in advance
Sequelize how to return result as a 2D array instead of array of objects?
I am using Sequelize query() method as follows: Because I am selecting two columns with identical names (colname), in the result, I am getting something like: [{ “colname”: “val1” }, { “colname”: “val2” }…], and this array contains values only from the column table2.colname, as it is overwriting the table1.colname values. I know that there is an option to use
Sequelize : How to query posts list from user id list?
To learn a little bit how a back end application works i’m currently creating a small instagram-like app using nodejs and sequelize (reactjs for the front). I have 3 SQL tables : Users id (pk) username email password Posts id (pk) userId (fk) message mediaUrl Following id (pk) userId (fk) followingId (fk) I would like to know what is the
req.query returns nothing
Trying to get variable from http://localhost:3000/categories/subcategories?category_id=13 but req.query returns empty result. Is this possibly a problem with the way I’ve set up my server? Answer See how you are passing the data , directly entering the data or from another URL you are passing the data. Ensuring you are not sending data via req.body. Ref : Empty req.query on ExpressJS
Nest Postgresql Sequelize one-to-one Error with ForeignKey
My Table Has one-to-one connection with table But when i try add some data in second table< i got an Error – Nest error insert or update on table “checkingResults” violates foreign key constraint “checkingResults_resultId_fkey” What happened? I try any thing… And how i remember – a don’t get this error before in this place, i don’t touch something in
MySQL Combine Group by Column
I am new to SQL statements so my wording per my request may be incorrect, so I will provide a lot of detail to better understand my issue. I have a database table called workouts that looks like this: id bodyPart gifUrl name target broad_target 1 back http://d205bpvrqc9yn1.cloudfront.net/0007.gif alternate lateral pulldown lats back 2 chest http://d205bpvrqc9yn1.cloudfront.net/0009.gif assisted chest dip (kneeling)
Can’t overwrite javascript array
I want to track changes of “results”. If the results.length increases, the array will be overwritten and saved. If the length decreases, then the array will be overwritten, but the new value won’t save. Answer I found de wae!