How to map date field in EDT format to C# poco class with datetime property

From: Rajendra Gupta <guptarajendra2000@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Wed, 11 May 2016 08:39:31 -0700 (PDT)
Why ads?
Hello,

I have stored my data in MobgoDB like.

db.requests.insert({

"_id" : "76f62a60-001b-11e6-8c47-02421d3a8dc5",

"controlnumber" : "2182048",

"created-date" : "Fri Mar 25 11:04:33 EDT 2016"

})


I have a POCO c# class like

public class RequestModel
    {
        public string Id { get; set; }
        public string ControlNumber { get; set; }        
        public DateTime CreatedDate { get; set; }  
    }

And want to map this class with MongoDB document with AutoMap as


BsonClassMap.RegisterClassMap<RequestModel>(map =>
            {
                map.AutoMap();
                map.SetIgnoreExtraElements(true);
                map.GetMemberMap(x => x.Id).SetElementName("_id");
                map.GetMemberMap(x => 
x.ControlNumber).SetElementName("controlnumber");                
                map.GetMemberMap(x => 
x.CreatedDate).SetElementName("created-date");                 
            });

When i keep all the properties are of string then its working fine however 
i facing issue while taking CreatedDate as DateTime type.

I appreciate, if anybody can help me on the approach to Map the DateTime 
field in Poco class.

  

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/ca7dfd51-5e97-43cd-9c30-bc44c371f172%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?