title: model.find() return empty in a function while works properly outside the function?
body: <p>I encountered a problem when using Mongoose in a nodejs express app. </p>
  
  <p>app.js:</p>
  
  <pre><code>model.find(function(err,result){
    console.log("testfind1：",result);
  })//works properly
  
  
  wss.on('connection',function(ws) {  
      ws.on('message',function message(msg){  
        model.find(function(err,result){
          console.log("testfind2：",result);
        })//returns empty array
      })
  })
  </code></pre>
  
  <p>The code above are all in the same .js file, and the result1 is correct while result2 is empty.</p>
  
  <p>Why? </p>