I get this error when I run and can not seem to resolve it. TypeError: data[key].trim is not a function The function is this one I am not sure how to solve this problem Answer I think there is a possibility what data[key] isn’t a string type. try this: Change if(data[key] !== “”) to if(typeo…
Tag: node.js
Not getting output while trying db.find() in Mongodb
Recently i have started learning mongodb and started to make a simple application that will just display the data present in my database. Here’s the code: After running this code, the data successfully gets stored in the database but it didn’t show me the output of all the data in my database. Can…
Making a signup form and login form using express server
So I am basically making a simple website on my localhost that has a signup form and some other html elements. I managed to setup the signup process smoothly. So when the user fills in the form and submits it to the root route(“/”), an email is sent to the subscriber containing a random password u…
Uncaught TypeError: Cannot read property ‘collection’ of null
I’ve been trying to get data out of a collection, but it returns me Uncaught TypeError: Cannot read property ‘collection’ of null. The Mongo database itself is connected with the cloud and checking from there the collection with that name exists. I have planned to later use the output for co…
“Twilio Quest” challenge, any help would be appreciated, I dont know what I’m doing wrong,
Can’t seem to get a hang of this “Twilio Quest” Challenge. Hey, I’ve been playing this game called “Twilio Quest” for the past week. I just wanted to learn JavaScript, and I think it looked kinda neat. The challenges served has been up and down in difficulty. But I’ve…
Puppeter delete node inside element
I want to scrape a page with some news inside. Here it’s an HTML simplified version of what I have : I want to get the author and text body of each news, without the blockquote part. So I wrote this code : It works well, but I don’t know how to remove the blockquote part of the “news-body…
Is there a way to scrape website using cheerio if the image that i want to scrape is protected by cloudflare and giving 1020 error?
I am trying to create a manga scraping website as a personal project and just when i completed the whole website, I got to know that the image cant be scraped or viewed by my website and when i try to go to the link of the image, I got 1020 error stating access denied, Is there any way I
Does deleting a property before replacing it change garbage collecting priority?
If you are replacing a property on an object that is a reference to a giant object, does it ever make sense to delete that property before replacing it? vs Answer No, it does not make any difference at all for garbage collecting. Unlike it’s name the delete operator just removes a property of an object.…
Getting TypeError: Cannot read property ‘name’ of undefined, while posting the form – node.js
I am building a node Js project and i am saving the values of form to a mongoDB database. Despite of trying i couldn’t find what is causing this error. Error is at router.post function on 3rd line. Please guide me through this through your magical powers of coding and debugging. 😀 you can see clearly I …
Socket in react is not listening for the second time
I’m very new to socket and trying to integrate socket in react and node.js simple CRUD application. My backend always emits the event and Frontend listens to the event. Below is the scenario I’m deleting an item from the list and for which I’m emitting an event from Backend after the record …