Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access property from database response #1787

Open
Stophface opened this issue Apr 30, 2024 · 0 comments
Open

Cannot access property from database response #1787

Stophface opened this issue Apr 30, 2024 · 0 comments

Comments

@Stophface
Copy link

Stophface commented Apr 30, 2024

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'].

It works when I do this

foo._raw['osm_type_id']

Why is that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant