Realm-js: Suggestion: add a "toPlainObject" call to Realm.Object

Created on 21 Dec 2016  路  1Comment  路  Source: realm/realm-js

I've been struggling a lot with this. Also, it's not the first time it's been asked (https://github.com/realm/realm-js/issues/323).

In the meantime, any suggestion on how to do this, specially when you have a complex schema (specifically, deep copy a Realm.Object to a plain Object)?

I tried using lodash's cloneDeep (https://lodash.com/docs/4.17.2#cloneDeep), but strangely it only works when remote debugging.

O-Community T-Enhancement

Most helpful comment

This is really important for me. I'm trying to fetch all the records from storage, and using map or forEach for only 900 records takes over 10 seconds. Example:
javascript // takes ~ 10ms, 900 records fetched const documents = ObjectExample.documents; // takes ~10-15s, doesn't even do anything documents.forEach((doc) => {const a = "b"});

>All comments

This is really important for me. I'm trying to fetch all the records from storage, and using map or forEach for only 900 records takes over 10 seconds. Example:
javascript // takes ~ 10ms, 900 records fetched const documents = ObjectExample.documents; // takes ~10-15s, doesn't even do anything documents.forEach((doc) => {const a = "b"});

Was this page helpful?
0 / 5 - 0 ratings