Realm returning proxy object when realm.objects is called
See original GitHub issueI am using realm 2.1.1, react-native 0.51.0 and running debug code on Android emulator.
Issue is that when I do let item = realm.objects('mySchema')
proxy object is returned.
Please note that I filter after.
I can get array object by using itemArray = Array.from(item)
but I have failed to update object within the write transaction.
When I do so nothing happens
realm.write(() => {
itemArray[0] = newItem
//new item is object created using a class
//with the constrator. It works well in
//realm.create()
});
Version of Realm and Tooling
- Realm JS SDK Version: 2.1.1
- Node or React Native: 6.11.4 or 0.51.0
- Client OS & Version: Windows 10
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
RealmJS - Displays proxy object instead of list of objects
"Proxy" objects are the corner-stone of Realm and its zero-copy philosophy. All the Realm SDKs are implemented the same way - instead of...
Read more >Object Models & Schemas - Java SDK — Realm - MongoDB
Realm guarantees that all objects in a realm conform to the schema for their object type and validates objects whenever they're created, modified,...
Read more >The things I've learned using Realm | by Gabor Varadi - Medium
Anyone who's used Realm knows that there is a price to pay with proxy objects and lazy results, which also extends to Realm's...
Read more >Lists - Beginning Realm on iOS - Introduction - YouTube
Each thread-local view returns proxy objects that only read from/write to the database when an accessor method is called, ...
Read more >Realm Object Server Documentation
The Realm Object Server synchronizes Realms between devices, provides authentication and access control services for Realms, and offers “serverless” event ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
filtered
returns a collection of objects matching the given predicate. Your code snippets attempt to use that collection as though it’s a single object, which won’t work. You need to retrieve the relevant object from the collection in order to update it.Thanks for the response. It’s true I create the realm objects using Realm.create as specified in the docs. Say for example
Say I want to change the make of Joe’s car. I query the database to give me a Joe object as follows
//code sample_2
let Joe = realm.objects('Person').filtered('name= "Joe"')
;And then I can update Joe’s car make by
My challenge is,
code sample_2
returns a proxy object, and therefore I cannot runcode sample_3
as it is given in that example.One more thing you should note, is that this is the second project where I am using Realm db, with the first one everything worked as expected, as stipulated in the docs. The Realm version was 2.0.3.
This second one with Realm 2.1.1 has got me scratching my head. Any help will highly be appreciated.