Closed tchukuchuk closed 12 years ago
The finder will only work for non-key fields. Find by key is not implemented (yet).
It will need to do a search with key:
NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
[search setKey:@"E01B4C77-B926-4807-AC76-7DCB728510C6"];
objects = [search searchObjectsWithReturnType:NSFReturnObjects error:nil];
in motion, it should be something like ...
search = NSFNanoSearch.searchWithStore(Player.store)
search.key = "E01B4C77-B926-4807-AC76-7DCB728510C6"
objects = search.searchObjectWithReturnType(NSFReturnObjects, error:nil)
Please see if that will work for you :)
Thanks @siuying. I had to fetch entries by keys too and your example worked for me (except for the small typo: searchObjectWithReturnType => searchObjectsWithReturnType).
It would be great to have a convenient finder method for this. Something like Player.find_by_key(key)
.
hi,
i have forked the project to add this feature.
regards,
julien
Le 28 août 2012 à 22:29, Fabio Kuhn notifications@github.com a écrit :
Thanks @siuying. I had to fetch entries by keys too and your example worked for me (except for the small typo: searchObjectWithReturnType => searchObjectsWithReturnType).
It would be great to have a convenient finder method for this. Something like Player.find_by_key(key).
— Reply to this email directly or view it on GitHub.
Hi
I don't see how I can get objects by key. In fact I would like to use NanoStore with relationships, for example :
The other way is to write something like this, but it may not be efficient :
Have you any suggestions ?
Best regards,
Julien