title: How to generate unique ID with node.js
body: <pre><code>function generate(count) {
      var founded = false,
          _sym = 'abcdefghijklmnopqrstuvwxyz1234567890',
          str = '';
      while(!founded) {
          for(var i = 0; i &lt; count; i++) {
              str += _sym[parseInt(Math.random() * (_sym.length))];
          }
          base.getID(string, function(err, res) {
              if(!res.length) {
                  founded = true; // How to do it?
              }
          });
      }
      return str;
  }
  </code></pre>
  
  <p>How to set a variable value with database query callback? How I can do it?</p>