title: How to verify if a Meteor.user username exists?
body: <p>I'm building a messenger application, and before a conversation is created I want to verify if a user exists. If it does, then it will create the conversation. If not, then it should return an error. I've been working with this code on the server side but for some reason it won't work. I've tried many different tweaks, but this is basically my structure:</p>
  
  <pre><code>Meteor.methods({
  createConversation: function(secondPerson) {
  
      function doesUserExist(secondPerson) {
          var userx = Meteor.users.findOne({username: secondPerson});
          if (userx === secondPerson) {
              return false;
          } else { 
              return true;
          }
      }
  
      if (doesUserExist()) { 
          Conversations.insert({
            person1: Meteor.user().username,
            person2: secondPerson
          });
  
      } else { 
          Conversations.insert({
            person1: "didn't work"
          });
      }
  
  
  
  }
  });
  </code></pre>