Stock price checker mongoose not returning updated value

Tell us what’s happening:
I am working on the stock price checker. I am having trouble getting mongoose to return the just updated likes value from my database. The return value is printed to the console before the database is updated even though the function to update the likes is async. Help would be much appreciated.

Lines 105 - 107 In /routes/api.js is what i am talking about in my glitch project below:

Your code so far

In file routes/api.js

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Stock Price Checker

Link to the challenge:

Any ideas? Thanks in advance

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.