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.
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"});
Most helpful comment
This is really important for me. I'm trying to fetch all the records from storage, and using
maporforEachfor 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"});