DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

sm-a
sm-a

Posted on

[SOLVED] How I use a synchronous queries with mongoose on NodeJS with ExpressJS

I want to process several querys synchronously one after the other. When I execute the code below, nothing happens. No error message or the same. What am I doing wrong?

Top comments (4)

Collapse
dmfay profile image
Dian Fay

Unless it's in the code you've omitted, you aren't actually executing getProductCount, only declaring it. I believe you can use async functions as routes with Express now so you shouldn't even need to split things out into a nested function like that.

Collapse
sma profile image
sm-a Author • Edited on

Thank you. You have right I do not executing the function. Now it works

Collapse
theodesp profile image
Theofanis Despoudis

โ€˜getProductCountโ€™ is a function. You need to call it

Collapse
sma profile image
sm-a Author • Edited on

Thank you. You have right I do not executing the function. Now it works.

Head to your account's Settings to...

๐ŸŒš Enable dark mode
๐Ÿ”  Change your default font
๐Ÿ“š Adjust your experience level to see more relevant content