Sorting by sub objects
See original GitHub issueAssume I have the following schema:
var Car = {
id: 'int',
make: 'string',
model: 'string',
};
var Person = {
id: 'int',
first_name: 'string',
last_name: 'string',
};
var Passenger = {
id: 'int',
person: {type: 'Person'},
car: {type: 'Car'},
};
If I do the following, I get the error Property ‘person.last_name’ does not exist on object type ‘Passenger’.
realm.objects('Passenger').sorted('person.last_name')
Is my syntax incorrect, or is sorting by sub-objects not supported? If it’s not supported, are there plans to support it?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:11 (7 by maintainers)
Top Results From Across the Web
How to sort a JavaScript array of objects by nested object ...
You can split the prop on . , and iterate over the Array updating the a and b with the next nested property...
Read more >Sorting JavaScript Arrays By Nested Properties - Elijah Manor
Imagine you have an array of JavaScript objects and you need to sort the data, but the items you need to sort are...
Read more >JavaScript Tips — Listeners, Sorting, and Nested Objects
To sort object properties by values, we can sort the keys by their values with the sort method. ... console.log(keysSorted);. We have the...
Read more >Sort nested array containing objects ascending and ...
Sort nested array containing objects ascending and descending according to date in JavaScript - Suppose we have a JSON Object that contains ...
Read more >Angular Default Sorting In Angular Material With Nested Objects
Starter project for Angular apps that exports to the Angular CLI.
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
It will be added but isn’t yet. This issue is for keeping track of it.
Support for this was added to core in realm/realm-core#1969 / realm/realm-core#2011.