I’m trying to perform a simple .find() query on my mongodbAtlas, but the result of this query is an empty object. this is my server file: this is my routes file: this is how my document is populated: Answer I think you are missing the “await” keyword after const data….. as API data fet…
how do I fix the total amount of pixel used from a grid in css?
I’m sorry if this is a repeated question and I’d like some help cause I’m a noob. I created a grid. But every time I enter a different number, it uses a different total amount of pixel. I want the height and the width of the body that contains grid to stay exactly the same size no matter wha…
How do i auto hide a div when selecting a second div in Javascript?
I’m having a hard time trying to figure out what’s wrong in my code. As i call the function clean() it cleans the screen without ever showing a <div>. If i call the function togglevisible() it shows the div i clicked on, although on a new element click it doesn’t hide the first element…
How to create new components on every button click in “React”
So I want when the user clicks on the button, be able to create new CatagoryField Component that I made. When I place the component in a function and call it it will only create the component once. I will appreciate some help. I’m confused about how should I implement this? App components Answer The bes…
useEffect shows data and then cannot read properties of undefined
I am getting data from a 3rd party API. When I console.log the data it shows in console but then is followed by Uncaught TypeError: Cannot read properties of undefined (reading ‘tweet_results’) I don’t actually get to see anything on the screen when I try the return as well, even though I ha…
How to draw colorful rotating flower in p5.js?
How can I color those leaves? I added fill(‘red’), fill(‘blue’) in front of each ellipse and somehow only one color dominates all of the petals. Plus, I want it to rotate at a constant speed. Answer Fill seems to work fine. (and added a loop to be more concise)…
Moment JS Date Difference as Month
I’m trying to get the difference between current local time and December 1, 2021 at 4 pm. There is a difference of 6 months and 2 hours. In this case I expect the answer to be something similar to 6.02. But 5.98 is coming. How can I get the answer I want? enter image description here Answer According to…
How to grouping array of data by its category in javascript
This is my data: How can I transform this data to grouping each pet according to its species and gender like like this: My code is: the result from my code is: I expect the final result is like the second array above. Does any one know how to do this better and explaining what I’m missing. Thanks!! Answ…
ES6 Partial Object Destructuring Default Parameters In A Separated Object
Okay so there’s a lot of similar questions here but none that actually address this. What if I want to save the default parameters of a function on a separated object, in a separated file and then I want the function to use this default parameters only if not specified when calling it? Example: And then…
I am trying to make my program list blog posts in order by the number of likes each blog has
I am currently working on a blog website and I want to list out the blogs in ascending order based on the amount of likes each blog has. However, whenever I run my current code, whenever I click “view” for one post, all of the post expand when I only want one of the post to expand, furthermore, wh…