Issue is that when I insert from Realm it shows like the second dataset below. But if I take the same JSON and insert via Compass or browser then it shows correctly i.e. the ObjectId’s are imported correctly.
I understand JSON can’t store object information but I can’t figure out the best way to insert a record via Realm which has reference to ObjectId’s of different collection objects. I tried for ex
> ran on Wed Jun 02 2021 00:57:09 GMT+0200 (Central European Summer Time)
> took 594.379835ms
> logs:
ID of the father doc: 60b6bb46646de5c50f28b2c4
{"_id":{"$oid":"60b6bb46646de5c50f28b2ca"},"name":"son","parent":{"$oid":"60b6bb46646de5c50f28b2c4"}}
{"_id":{"$oid":"60b6bb47646de5c50f28b2d1"},"name":"forged","parent":{"$oid":"60b6b6779fa4e9249123a35e"}}
> result:
"Done!"
> result (JavaScript):
EJSON.parse('"Done!"')