Hi @Zaid-Ajaj
Nullable DateTime is throwing when trying to read from the database. When inserting the value in the database, the JToken used is StartObject, but when reading it expects DateTime, that throws an exception.
These are the test cases:
testCase "Documents with Nullable DateTime != null can be used" <| fun _ ->
useDatabase mapper<| fun db ->
let docs = db.GetCollection<RecNullableDateTime>()
let date = Nullable DateTime.MinValue
docs.Insert ({ Id = 1; Date = date }) |> ignore
docs.FindAll()
|> Seq.tryHead
|> function
| None -> fail()
| Some doc ->
match doc.Id, doc.Date with
| 1, date -> pass()
| _ -> fail()
testCase "Documents with Nullable DateTime = null can be used" <| fun _ ->
useDatabase mapper<| fun db ->
let docs = db.GetCollection<RecNullableDateTime>()
let date = Nullable()
docs.Insert ({ Id = 1; Date = date }) |> ignore
docs.FindAll()
|> Seq.tryHead
|> function
| None -> fail()
| Some doc ->
match doc.Id, doc.Date with
| 1, date -> pass()
| _ -> fail()
Hi @Zaid-Ajaj Nullable DateTime is throwing when trying to read from the database. When inserting the value in the database, the JToken used is StartObject, but when reading it expects DateTime, that throws an exception.
These are the test cases: