title: How to map mongo bson array to c# object , then save in SQL using Entity framework
body: <p>I have a mongodb bson collection with the following structure, the credentials[] is causing problem, can you please recommend a solution. I have device class and has navigation property for entity framework. context is also set, just the json array is causing problem since it has strings inside and  not a document. 
  <strong>Bson Document</strong></p>
  
  <pre><code>{
  "_id" : ObjectId("592dbf1446dbac785d6556a5"),
  "deviceName" : "Computer1",
  
  "updated" : ISODate("2017-06-30T20:18:25.681Z"),
  "credentials" : [ 
      "fa4bafad-51b0-494c-89d8-6154f23bf3af", 
      "3138ac95-b9e6-4dbe-9825-f109c0d47f67"
  ],
  
  "lastActivity" : ISODate("2017-06-06T17:55:35.894Z"),
  "clientVersion" : "2.14.0"
  </code></pre>
  
  <p>}</p>
  
  <p>C# classes</p>
  
  <pre><code>    public  class Device
  {
  
      [Key]
  
  
      public string _id { get; set; }
      public string deviceName { get; set; }
      public DateTime? updated { get; set; }
      public  string clientVersion { get; set; }
  
      public  DateTime lastActivity { get; set; }
      public ICollection &lt;Credentials&gt; credentials { get; set; }
  
  
  }
  
  
  
  public class Credentials
  {
  
      [Key]
  
      public Guid CredentialId { get; set; }
  
      public string credentials { get; set; }
      [ForeignKey("Device")]
      public string DeviceId { get; set; }
      public virtual Device Device { get; set; }
  
  
  }
  
   using (var context = new GkDataContext())
          {
  
              var deviceCollection = await Db.GetCollection&lt;Device&gt;("Devices").Find(new BsonDocument()).ToListAsync();
  
              context.device.AddRange(deviceCollection);
  
              context.SaveChanges();
  
  
          }
  </code></pre>