© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
100 replies
TeBeCo

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

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


the close operator I found to
Where
Where
is
Find
Find

the close operator I found to
FirstOrDefault(predicate)
FirstOrDefault(predicate)
are tiher
*
FindOneOr|Delete|Reaplce
FindOneOr|Delete|Reaplce
which seems fucking dumb
*
Find( + limit:1)
Find( + limit:1)
which return
IEnumerable<T>
IEnumerable<T>
and not
T
T
which seems fucking dumb
*
FindOne()
FindOne()
was mentionned in older documentation but cannot find in current version

can someone show me the real place to do a
FindOne(predicate)
FindOne(predicate)
returning either
*
T
T
or throw => equivalent of
First(predicate)
First(predicate)

*
T
T
or default(T) => equivalent of
FirstOrDefault(predicate)
FirstOrDefault(predicate)

* I'd be ok with
Result<T>
Result<T>
if I have to check success + direct T

please someone prouve me it's me
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

❔ MongoDB.Driver.MongoConnectionException:
C#CC# / help
3y ago
✅ Where is c# documentation?
C#CC# / help
11mo ago
❔ ASP.NET, MongoDB, C#
C#CC# / help
3y ago