I can get a collection in MongoDB using F# No problem using
let draws = db.GetCollection<Draw>("draws").Find(fun _ -> true)
To Sort I would expect it to be:
let draws = db.GetCollection<Draw>("draws").Find(fun _ -> true).Sort(Builders<Draw>.Sort.Descending(d => d.drawDate))
But I am getting the following error. In the intellisense all of the types seem to be recognised all the way through so I am not sure what to do.
A unique overload for method 'Descending' could not be determined based on type information prior to this program point. A type annotation may be needed.
Your second lambda is using C# syntax. I'm not sure if that's what's causing the compiler error, but I think it's easier to do something like this anyway:
let draws =
db.GetCollection<Draw>("draws")
.Find(fun _ -> true)
.SortByDescending(fun d -> d.drawDate :> obj)
(Note that the SortByDescending function requires a result of explicit type object, but it shouldn't cause any problems for you. I think this is because the driver was created with C# clients in mind, where the upcast is implicit.)