Closed randallmeeker closed 4 years ago
Hey, will check it out next week. I'm off this week.
you are absolutely right.
I will update the getValue method to be the same
then the valuesChanges
thanks @randallmeeker ! fix is available in 3.0.5
This is great. Thanks.
I finally was able to upgrade and I'm not seeing the changes, or possibly not understanding how it is supposed to be implemented. I was looking to have the ID column on the valueChanges method. But it is not. Does this mean is was never supposed to be on there and getValue was wrong?
Let me check tomorrow
so I just checked and I get the ids in both functions... Maybe there is something else wrong here?
Following up on this
There and I don't think this is an easy fix
Basically, valueChanges() is just a passthrough, which does not return enough info to merge and ID on the field.
vs
This would probably have to be a new method on the collection service (maybe called collectionService.select) that performs builds a ministore and watches for changes.
Hopefully, I have some time and maybe can help contribute to this
thanks for coming back about that. Will have a look today into that
do you put your id inside of the document? Cause if you don't then yes you won't get an id back if you are using the valueChanges method. But if you would use the add function when adding something to a collection, the id will get merged with the new data. I could overwrite it again the idKey to make sure that we include the id in the new data, but this can have a lot of side effects
Unfortunately in this instance, the data is not being initially generated by my app. So the ID field does not exist on the document itself.
Just one of those hinky things where this library does so much out of the box, that I need to be explicit when working with other systems that are also working with the data that they need to put an ID field on the records.
We are early enough in this app that adjustments can be made as such.
I'm still intrigued by a select
method on the collection service though. It would like a synced store. So that when a change occurs your not hit for a full run of reads for the entire query. Plus you solve this ID field issue. Unless there is already a smart way to do this.
It would appear that on a collection valueChanges (Observable) and getValue (Promise) are different in that getValue will put the document ID on the returned array object and valueChanges will not. Is this expected behavior?