title: How to insert data into a mongodb collection using the c# 2.0 driver?
body: <ol>
  <li>I'm using the <code>MongoClient</code> in my c# console application to connect to MongoDB</li>
  </ol>
  
  <p><a href="https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.0.0-rc0">https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.0.0-rc0</a></p>
  
  <ol start="2">
  <li><p>My code</p>
  
  <pre><code>  class Program
     {
         static void Main(string[] args)
         {
          const string connectionString = "mongodb://localhost:27017";
  
          // Create a MongoClient object by using the connection string
          var client = new MongoClient(connectionString);
  
          //Use the MongoClient to access the server
          var database = client.GetDatabase("test");
  
          var collection = database.GetCollection&lt;Entity&gt;("entities");
  
          var entity = new Entity { Name = "Tom" };
          collection.InsertOneAsync(entity);
          var id = entity._id;          
      }
  }
  
  public class Entity
  {
      public ObjectId _id { get; set; }
      public string Name { get; set; }
  }
  </code></pre></li>
  <li><p>After successfully running the code above, I'm unable to find this record in the MongoDB database using this command:</p>
  
  <pre><code>db.entities.find().pretty()
  </code></pre></li>
  </ol>
  
  <p>What's wrong with my code? </p>