Maximum call stack size exceeded when filtering objects with inverse relationship

Giving the following schema -->

const Person = {
  name: "User",
  primaryKey: "_id",
  properties: {
    _id: "objectId",
    name: "string",
    age: "number",
    company: "Company[]"
  }
};

const Company = {
  name: "Company",
  primaryKey: "_id",
  properties: {
    _id: "objectId",
    name: "string",
    boss: {
      type: 'linkingObjects',
      objectType: 'Person',
      property: 'company'
    }
  }
};

After adding some persons and several of them with a company, I try to filter by age and get the ones that are over 30 years with -> realm.objects("Person").filtered("age > 30");

The result of this query is the following error -> Maximum call stack size exceeded.

I expect to have a list of Persons which meets the requirement but instead I have this error. I have seen that in the release 10.0.0 this error is suppose to be fix for toJSON() and indeed if I try to filter the object by its id everything works fine but once I try to get a list of some objects I get this error.

Does somebody have a solution for this?

Hi @Fabio_GC,

Can you confirm the specific Realm SDK version you are using?

Thanks,
Stennie

Hello @Stennie_X

I´m using -->

  • Realm: 10.1.1

  • React Native: 0.62.2

  • Node: 10.22.1

After further investigation on this topic I´v seen that this problem is only happening with Jest while executing test.