I am making this website project where people can leave comments and the webpage will dynamically display the comments without reloading the page. My comments are stored in an array in my server in the format Allcomments=[ { username: ‘username’, info: ‘title’, commentinfo: ‘comm…
Tag: node.js
How to query on collection values and referenced documents values in MongoDB?
I don’t know how correctly I formulated the question. I need to execute a query on both the values of the collection and the values of the referenced objects. The original collection looks like this: When executing a query that meets the condition district == “Texas”, I need to get the f…
Iterate over cells in a CSV file in Node.js
I have a CSV file: “myCSV.csv” with two columns: “first” and “second”. All the data inside is just numbers. So the file looks like this: I would like to iterate over these numbers and perform some custom parsing on them, then store results in an array. How can I achieve a b…
Node JS Dialogflow error :INVALID_ARGUMENT: Input text not set.?
I encountered the following error while sending POST request to the Node JS code. There was a similar but unanswered 2 years old question in stackoverflow. So I decided to ask. My code: Error i received: POST request : Answer Found the answer I had missed the header. It was solved after adding the POST header…
guildMemberAdd and guildMemberRemove Embeds not sending anymore (Discord.js)
I’m very confused about this because they were once working, but now I don’t even get any error messages. Here’s the code: (Welcome Embed) (Goodbye Embed) Screenshot of it working: I also have a guildCreate and guildRemove underneath it as well, but I don’t know if that’s the rea…
HttpOnly cookie is set only after the second request
I have a server (Node.js + Nest.js) and a client (Angular 11). The client submits a login request and the server logs in the user and sets a HttpOnly cookie in the response. The wierd thing is that the cookie is set in the browser only after submitting 2 requests, then it works fine (If i use postman for exam…
Running a query inside the same connection in nodejs
There is a need to run the second sql query (query2) after building it using results of first query (query1) in mentioned space in code snippet, this second sql query will be generated according to the results of first query. but when I tried to run this, it builds the second query without any issue, but it i…
Is there any way to make IDEs like VSCode recognize global variables that don’t exist yet? (Node)
So I know the question is probably super confusing but basically I have a file in my node project that when importing one of the exports it will set the value of variable in the global scope as a getter. Basically this means that you can call the same value over and over again and get different results. For e…
Match based on a field only with non-empty array
I am trying to do a filter on something. Here is a simplified layout of my Order model: I want to query the documents based on the ingredients that they contain. I have an array of items to search through “objectifiedIngredients”. If it has ingredients in it, then I want to search for orders that …
Cannot read property ‘path’ of undefined while uploading image upload on the frontend(react)
I am trying to upload an image on the frontend, but this is not working, I am getting the error below When I log req.file on the backend and try to upload on the frontend, I get undefined in the console, but this gets logged for req.body Image upload works fine on the backend via Postman. Here is the frontend