title: CompoundJS: Populating database with seed file hangs
body: <p>I'm trying to populate my CompoundJS application's Mongo database with seed files, but whenever I run <code>compound seed</code>, the terminal hangs after my console.log statements... the database fills, but I have to kill the command with Ctrl-c.</p>
  
  <p>I've tried doing <code>compound seed harvest</code>, but that doesn't create proper seed files, so I've decided to make my own.  Here is my respective code:</p>
  
  <p><strong>db/seeds/development/Host.js</strong> (seed file)</p>
  
  <pre><code>console.log("Seeding Hosts....");
  
  var hosts = [
    {
      hid: '1',
      name: 'MY API',
      domain: 'mydomain.com'
    }
  ];
  
  hosts.forEach(function(obj, err){
    Host.create(obj, function(err, host){
      console.log('host Added: ', host);
    });
  });
  </code></pre>
  
  <p><strong>db/schema.js</strong></p>
  
  <pre><code>var Host = describe('Host', function () {
      property('hid', String);
      property('name', String);
      property('domain', String);
      set('restPath', pathTo.hosts);
  });
  </code></pre>
  
  <p><strong>config/database.js</strong></p>
  
  <pre><code>module.exports = {
      development: {
          driver:   'mongodb',
          url:      'mongodb://localhost/apicache-dev'
      },
      test: {
          driver:   'mongodb',
          url:      'mongodb://localhost/apicache-test'
      },
      production: {
          driver:   'mongodb',
          url:      'mongodb://localhost/apicache-production'
      }
  };
  </code></pre>
  
  <p>Like I said, when I run <code>compound seed</code>, it shows both console.log statements, and it puts my data into the database, but it just hangs... never actually returning to the command line, so I'm forced to kill it with Ctrl-c.  I would like to solve this problem, as I have to automate this process, and it's a bit hard automating if it's just hanging.  What am I doing wrong?  Any help would be appreciated!</p>
  
  <p><a href="https://groups.google.com/forum/#!topic/compoundjs/oXd69ISelVs" rel="nofollow">Cross-posted.</a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So when I try to use the Coffee script version that's generated from <code>compound seed harvest</code>:</p>
  
  <p><strong>db/seeds/development/Host.coffee</strong></p>
  
  <pre><code>Host.seed -&gt;
      hid: '1'
      name: 'MY API'
      domain: 'mydomain.com'
      id: "52571edd2ac9056339000001"
  </code></pre>
  
  <p>I get the error <strong>collection name must be a String</strong>.  So I was a little curious and went to where that error was being generated... in <strong>node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/collection.js</strong> on line 103.  I put a <code>console.log(collectionName)</code> right before that if statement and saw an interesting output...</p>
  
  <pre><code>{ hid: '1',
    name: 'MY API',
    domain: 'mydomain.com',
    id: NaN }
  </code></pre>
  
  <p>So clearly it's not a string, but a hash object, and my collection's name (<strong>Host</strong>) is nowhere in sight.  Seems like a bug to me.</p>