title: Insert data in collection at Meteor's startup
body: <p>I would like to insert data at Meteor's startup. (And after from a JSON file)</p>
  
  <p>At startup, I create a new account and I would like to insert data and link it to this account once this one created.</p>
  
  <p>This is the code that creates the new account at startup:</p>
  
  <pre><code>if(!Meteor.users.findOne({emails: { $elemMatch: { address: "test@test.com"}}})){
      var id = Accounts.createUser({ email: "test@test.com", password: "1234", profile: { name: 'Test' } });
      Meteor.users.update({_id: id }, { $set: { admin: false }});
  }
  </code></pre>
  
  <p>And after that, I need to insert data and link it to this account with its ID. (In different collections).</p>
  
  <p>So I tried to do something like that, but obviously It didn't work:</p>
  
  <pre><code>UserData = new Mongo.Collection('user_data');
  
      if(!Meteor.users.findOne({emails: { $elemMatch: { address: "test@test.com"}}})){
          var id = Accounts.createUser({ email: "test@test.com", password: "1234", profile: { name: 'Test' } });
          Meteor.users.update({_id: id }, { $set: { admin: false }});
          UserData.insert({
              createdBy: id,
              firstname: "test",
              /* ... */
          });
      }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Sorry for not have been clear.</p>
  
  <p>The real issue is the :</p>
  
  <pre><code>UserData = new Mongo.Collection('user_data'); 
  </code></pre>
  
  <p>declaration is in another file, so I can't do like above.</p>
  
  <p>As it's not in the same file, I tried to get the userId that got "test@test.com" as the email (the account's email created at startup). And once I got it, I want to use it in "createdBy: ID_HERE".</p>