testCollection.find() is an asynchronous call to the database. In your example, the find method is executed asynchronously, and then the logger methods are immediately executed before the find callback is invoked. If you move the logger statements at the end of this code to within the callback (after the for loop) it should resolve this issue.
over 4 years ago
I tried with awaitdata but still its not seems to be working.... and do I need to set it to response in find itself ?