question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sorting by sub objects

See original GitHub issue

Assume 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:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
kristiandupontcommented, Mar 29, 2017

It will be added but isn’t yet. This issue is for keeping track of it.

3reactions
bdashcommented, Jan 6, 2017

Support for this was added to core in realm/realm-core#1969 / realm/realm-core#2011.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found