title: mongodb C# exception Cannot deserialize string from BsonType Int32
body: <p>I am new to using mongo db in C# , but I am trying to import large database in mongo db.
  MyDb consists entities having only simple parameters Id , Body , Title Tags. </p>
  
  <p>This is example of entity in mongo. </p>
  
  <pre><code>{
  "Id" : "someff asdsa",
  "Title" : "fsfds fds",
  "Body ": "fsdfsd fs",
  "Tags" : "fsdfdsfsd"
  }
  </code></pre>
  
  <p>This is my class of mongoEntity in C#</p>
  
  <pre><code> [BsonIgnoreExtraElements]
      class Element
      {
          [BsonId]
          public ObjectId _id { get; set; }
          [BsonElement("Id")]
          public string Id { get; set; }
          [BsonElement("Title")]
          public string Title { get; set; }
          [BsonElement("Body")]
          public string Body { get; set; }
          [BsonElement("Tags")]
          public string Tags { get; set; }
  
          public void ShowOnConsole()
          {
              Console.WriteLine(" _id {0} Id {1} Title {2} Body {3} Tags {4} ", _id, Id, Title, Body, Tags);
          }
  
      }
  </code></pre>
  
  <p>This is my code in Main method </p>
  
  <pre><code>  const string connectionString = "mongodb://localhost";
              var client = new MongoClient(connectionString);
  
              MongoServer server = client.GetServer();
              MongoDatabase database = server.GetDatabase("mydb");
  
  
              MongoCollection&lt;Element&gt; collection = database.GetCollection&lt;Element&gt;("train");
              Console.WriteLine("Zaimportowano {0} rekordow ", collection.Count());
  
              MongoCursor&lt;Element&gt; ids = collection.FindAll();   
  
               foreach (Element entity in ids)
               {
                   entity.ShowOnConsole();
               }
  </code></pre>
  
  <p>When i run this code I am able to see some data, but I'v got exception
  "Cannot deserialize string from BsonType Int32."
  I think that one of property is represented in database as int , but I dont know how to deal with it ? How come one property in one entity is int and the same property in another object is string ?
  What I have to do to read all database ?</p>