realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

How to create a clone of realm object in Realm JS

Open ugendrang opened this issue 7 years ago • 2 comments

Is it possible to copy a RealmObject and assign a different primary key to it and store this Object to Realm DB.

It looks this can be achieved in Realm Java as realm.copyToRealmOrUpdate(objCopy).

Any advise on similar behaviour in Realm JS?

ugendrang avatar Jun 15 '17 15:06 ugendrang

any update on this...???

guptaamol avatar Apr 26 '18 12:04 guptaamol

As a work-around you can use let jsObject = JSON.parse(JSON.stringify(realmObject))

kneth avatar Jun 27 '22 11:06 kneth