Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Handling ISODate in mongoDB when Deserializing from JSON

Handling ISODate in mongoDB when Deserializing from JSON

Scheduled Pinned Locked Moved Database
questionmongodbhelpcsharpdatabase
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ThetaClear
    wrote on last edited by
    #1

    Hi, First, I didn't see a mongoDB forum here so I think that's the closest place to ask a DB question. Ok, so I'm using MongoDB in my web application and using C# driver to interact with it. I ran across a problem that I can see a lot of people encountered and that is: How can I deserialize a JSON string that I get from mongo when I have a field, called DateAndTime which has the value much like this one: ISODate("2014-04-19T06:01:17.171Z") I get an exception that this is, and of course it is, an invalid JSON type. I came across a solution in Stackoverflow which said to do this:

    string json; // Assign JSON here.
    var v = Newtonsoft.Json.JsonConvert.DeserializeObjectAsync(json);

    but this also didn't helped. How can I get around this issue or solve it? Or perhaps is there a way to configure how mongo will save dates?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups