title: Unable to use MongoDB from my C# console application
body: <blockquote>
    <p>Unable to connect to server localhost:27017: Command 'ping' failed: no > such cmd (response: { "errmsg" : "no such cmd", "ok" : 0.0 }).</p>
  </blockquote>
  
  <hr>
  
  <p>This might be a basic stuff which I'm missing out here... Please help me out</p>
  
  <p>The above is the exception which I'm getting...<br>
  Below is the code which I'm using (It's the sample demo given in the site)
  Note: My database is running. I'm able to create and edit the database from command line.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  using MongoDB.Bson;
  using MongoDB.Driver;
  using MongoDB.Driver.Builders;
  
  namespace MongoDBTest
  {
      public class Entity
      {
          public ObjectId Id { get; set; }
          public string Name { get; set; }
      }
  
      class Program
      {
          static void Main(string[] args)
          {
              var connectionString = "mongodb://localhost/?safe=true";
              var server = MongoServer.Create(connectionString);
              var database = server.GetDatabase("test");
              var collection = database.GetCollection&lt;Entity&gt;("entities");
  
              var entity = new Entity { Name = "Tom" };
              collection.Insert(entity);
              var id = entity.Id;
  
              var query = Query.EQ("_id", id);
              entity = collection.FindOne(query);
  
              entity.Name = "Dick";
              collection.Save(entity);
  
              var update = Update.Set("Name", "Harry");
              collection.Update(query, update);
  
              collection.Remove(query);
          }
      }
  }
  </code></pre>