C#C
C#3y ago
TeBeCo

❔ [MongoDB][C# driver] Where the fuck is FindOne ?

I'm looking at doing the equivalent of what C# generally does with .First() / .FirstOrDefault()

the close operator I found to Where is Find
the close operator I found to FirstOrDefault(predicate) are tiher
  • FindOneOr|Delete|Reaplce which seems fucking dumb
  • Find( + limit:1) which return IEnumerable<T> and not
    T
    which seems fucking dumb
  • FindOne() was mentionned in older documentation but cannot find in current version
can someone show me the real place to do a FindOne(predicate) returning either
  • T
    or throw => equivalent of First(predicate)
  • T
    or default(T) => equivalent of FirstOrDefault(predicate)
  • I'd be ok with Result<T> if I have to check success + direct T
please someone prouve me it's me
Was this page helpful?