I don’t know if the tests are buggy or not but in some cases when the tests say timed out try to re run it multiple times… it works for the 2nd or the 5th time
this is the only thing seems to work… as our code is correct but it seems that the most of the mongo and mongoose section tests are all buggy
I believe the lesson suggests that you store the results in a variable for later execution through .exec(). Although the lesson teaches to use this syntax, async await with a Try & Catch block is more efficient. Below is the coding I used to solve this lesson. From my understanding it’s always good practice to return the data to the client but in this case there really isn’t one so I returned it in the console instead:
in the call back fir the .exec the variable data is used to represent errorless response with some values in in,
that is why he have to use data for now untill it is running within the .exec functional scope you can name the variable by any name you like , but one it is the scope , only it will be responsible for the outcome. as the second one is null.
oh alright, I got it. Thanks for clarifying. In that case, I think he had to use data in both places right? I was saying that the same values should be used in both places