fetching single record
timolor opened this issue · 2 comments
timolor commented
Would there be a provision to fetching/finding just one record?
Say maybe a findOneCopiedWithChanges
Zhuinden commented
Theoretically you could do that, but because of how Realm queries work for single object, it's much safer to get them in a single item list. You can even use LIMIT(1) to ensure it. 👀
Then if it's empty, then it's empty, otherwise get(0)
timolor commented
Yeah, thanks.
I had to do just that. I suppose distinct
should work as well with a where clause, especially when the find parameter is a unique/primary column