You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
js-data-firebase works best when the key is part of the result set. If you use js-data-firebase to create records in firebase, then it will save the key to the result set for you. It looks like you may be loading items that were not created by js-data-firebase, and thus do not have the key in the result set.
Hi Jason,
You are right it is simpler as you suggest,
but my idea is to make hidden property idAttribute, and now going back to it, even i think is better to attach it to prototype of the value object not to value object itself, like that we don't need to copy key data also to the the node value.
Using Object.defineProperty is creating new property which is not writable, not enumerable and can't be deleted, that is my idea.
Mi Idea for creating a property on prototype is not working, so I'm going back to initial idea.
So i used Object.defineProperty just to add property attributes as i explained above. In plus we need to add check if the property already exist just not to overwrite it like:
if (!value.hasOwnProperty(mapper.idAttribute)) {
Object.defineProperty(value, mapper.idAttribute, {
value: key
})
}
as return from
_find
and_findAll
we have result array of objects result ofdatasnapshot.val()
and key of the result is not part of the result set.I suggest that we create
mapper.idAttribute
property on the result set objects array._findAll
will look like this:this part is added.
Best,
Jovan
The text was updated successfully, but these errors were encountered: