title: Run mongodb script once to insert initial data
body: <p>I have a chicken and egg problem with my node server in which you need to have a user with a certain role that has certain permissions to be able to log in and start creating more users, roles, etc.</p>
  
  <p>I would like to initialize the database such that I create an initial ADMIN role and initial admin user that has that role.</p>
  
  <p>I.E. started with a script and ran into problems:</p>
  
  <pre><code>use mydb
  
  db.roles.insert({
    name: "ADMIN_ROLE",
    description: "Administrative role",
    permissions: ['ALL']
  });
  
  db.users.insert({
    username: "admin",
    password: "password",
    role: ??? (get ADMIN_ROLE _id from above)
  });
  </code></pre>
  
  <p>Basically I ran into a couple of problems:
  1. not really sure if I can script like this.
  2. How to get ADMIN_ROLE id to store in new admin user</p>
  
  <p>Another idea:
  Write a quick node app that connects to mongodb and inserts the proper stuff.  Anyone done this before.</p>
  
  <p>And yet another:
  Does anything like ruby rake exist for node/mongo.  I.E. the initial seed may not be the only data I need to 'manually' mess with.  I.E. I might need to patch the database at some point in time.  Would be nice to create patch #1 as the initial seed, and then be able to write future patches if necessary and be able to.  I.E. anything like rake migrate?</p>
  
  <p>Any other ideas on how to seed a mongo database?</p>