Open Stophface opened 6 months ago
I cannot access a property from my database in JS, eventhough it is clearly there.
const foo = {"__changes": null, "_isEditing": false, "_preparedState": null, "_raw": {"_changed": "", "_status": "created", "continent_id": "8", "country_id": "193", "id": "197126", "latitude": 52.51993, "longitude": 13.43585, "name": "St. Pius-Kirche", "osm_type_id": "21", "quest_type_id": "3", "visited_date": ""}, "_subscribers": [], "collection": {"_cache": {"_debugCollection": [Circular], "map": [Map], "recordInsantiator": [Function anonymous], "tableName": "europe_quest"}, "_subscribers": [], "changes": {"closed": false, "currentObservers": null, "hasError": false, "isStopped": false, "observers": [Array], "thrownError": null}, "database": {"_isBeingReset": false, "_isBroken": false, "_pendingNotificationBatches": 0, "_pendingNotificationChanges": [Array], "_resetCount": 0, "_subscribers": [Array], "_workQueue": [WorkQueue], "adapter": [DatabaseAdapterCompat], "collections": [CollectionMap], "schema": [Object]}, "modelClass": [Function EuropeQuest]}}
I want to access "osm_type_id": "21" which I try like this foo['osmTypeId']. This returns undefined. I also tried it like this foo['osm_type_id'] which also returns undefined. Strange enough, I can access any other property like foo['questTypeId'].
"osm_type_id": "21"
foo['osmTypeId']
undefined
foo['osm_type_id']
foo['questTypeId']
It works when I do this
foo._raw['osm_type_id']
Why is that?
I cannot access a property from my database in JS, eventhough it is clearly there.
I want to access
"osm_type_id": "21"
which I try like thisfoo['osmTypeId']
. This returnsundefined
. I also tried it like thisfoo['osm_type_id']
which also returnsundefined
. Strange enough, I can access any other property likefoo['questTypeId']
.It works when I do this
Why is that?