Sorting in request's order
See original GitHub issueGoals
I have a filtered request with several conditions in it, I want the results to be filter in the same order. Let say, I do this request :
const query = [4, 2, 3, 1].map(id => `id = ${id}`).join(' OR ');
const users = await realm.objects('Contact').filtered(query);
return users;
Expected Results
I want the results to be ordered in that particular order => Contact with id 4, Contact with id 2, Contact with id 3, Contact with id 1.
Actual Results
The results are filtered by id => Contact with id 1, Contact with id 2, Contact with id 3, Contact with id 4.
Steps to Reproduce
Simply execute the request above, the schema is below.
Code Sample
Schema :
const Contact = {
name: 'Contact',
primaryKey: 'id',
properties: {
id: 'int',
lastname: 'string',
firstname: 'string',
address: 'string',
phones: 'string',
email: 'string',
picture: 'string?',
birthday: 'date?',
birthplace: 'string?',
}
};
Version of Realm and Tooling
- Realm JS SDK Version: 2.2.7
- Node or React Native: React Native 0.53.0
- Client OS & Version: iOS and Android
- Which debugger for React Native: None
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
How to sort the order of request types in the group in JIRA ...
You can sort it manually. There is no option to sort them e.g. alphabetically.
Read more >Using python 'requests' package to sort by date - Stack Overflow
I want to read in the most recent press releases, and am trying to sort by date. I use requests in the following...
Read more >How to Use sorted() and sort() in Python - Real Python
In this guide, you'll learn how to sort various types of data in different data structures, customize the order, and work with two...
Read more >Is there a way to sort the console and network, by time for ...
Here's how to restore chronological sort order for the Network tab: Right click the Waterfall column header; In the popup menu, ...
Read more >Paging and ordering results for a RESTful request
By default, results are sorted in ascending order ( orderBy=name ). This example sorts the result list on the name property. You can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I’ve been able to have the result I want with a filter function 😃 I think we can close this issue.
Thank you all.
@kneth thank you 😃 This is exactly how I did it for now 😃 Works good 👍