Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EJson export doesn't support backlinks #1616

Closed
derrickgw opened this issue Apr 3, 2024 · 2 comments · Fixed by #1617
Closed

EJson export doesn't support backlinks #1616

derrickgw opened this issue Apr 3, 2024 · 2 comments · Fixed by #1617

Comments

@derrickgw
Copy link

Problem

Backlinks in a Realm object cause a stack overflow error when exporting to EJson. This is somewhat expected, as following backlinks will certainly lead to circular references.

Solution

Ideally we would be able to annotate fields to specify how we want to export them. Maybe we some fields excluded, or other to be shallowly exported (id only).

Alternatives

Currently we can write a custom export function, but then we don't get to use the magic of auto-generated code.

How important is this improvement for you?

Would be a major improvement

Feature would mainly be used with

Local Database only

Copy link

sync-by-unito bot commented Apr 3, 2024

➤ PM Bot commented:

Jira ticket: RDART-996

@nielsenko
Copy link
Contributor

@derrickgw Thank you for reporting this. Backlinks obviously shouldn't be serialized as they are guaranteed to cause cycles during serialization, and are never used during de-serialization as it is a computed value. I will fix that promptly.

But the problem can occur without backlinks as well, if you use explicit cycles in your model.

My current thinking is to track already serialized realm objects, and refer to these with DBRefs (https://www.mongodb.com/docs/v2.4/reference/mongodb-extended-json/#db-reference) to avoid cycles.

This creates another challenge with deserializing refs to (yet) unseen objects.

I expect to have this fledged out later this spring. Sorry for the inconvinience.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants