Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetching single record #36

Open
timolor opened this issue Mar 20, 2022 · 2 comments
Open

fetching single record #36

timolor opened this issue Mar 20, 2022 · 2 comments

Comments

@timolor
Copy link

timolor commented Mar 20, 2022

Would there be a provision to fetching/finding just one record?
Say maybe a findOneCopiedWithChanges

@Zhuinden
Copy link
Owner

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
Copy link
Author

timolor commented Mar 20, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants