FirebaseUI-iOS icon indicating copy to clipboard operation
FirebaseUI-iOS copied to clipboard

Add documentation how to transform firestore table datasource content before data is handed to the table

Open swftvsn opened this issue 7 years ago • 7 comments

Hi!

I saw that this is supported in Realtime Database (#183) and was wondering if there is any documentation available how to use this in Firestore applications?

Any help and pointers are appreciated, thanks!

swftvsn avatar Jul 29 '18 12:07 swftvsn

This isn't currently supported in Firestore. You can get away with more via more flexible querying in Firestore, but there's definitely use cases that aren't covered there.

I'll see if I can get this into the next release. cc @samtstern

morganchen12 avatar Aug 06 '18 18:08 morganchen12

Is there a workaround for reversing firestore results on the client similar to #436?

mickeyreiss-visor avatar Aug 08 '18 06:08 mickeyreiss-visor

You can use order(by:) on Firestore's Query type to sort the results the query returns. It's not a great workaround and sometimes means adding data for the sake of sorting.

morganchen12 avatar Aug 08 '18 17:08 morganchen12

That works, but I can’t figure out how to combine order and limit to produce a reversed feed. For example, this is useful in a chat interface, where I want to render the 30 latest messages, newest on bottom.

It would be helpful if the data source had an option to reverse the data source.

mickeyreiss-visor avatar Aug 08 '18 19:08 mickeyreiss-visor

Ah ok I know what you're asking about. In Realtime Database we called this "limitToLast()" and it's definitely something we are missing in Cloud Firestore! We've discussed adding this, but you're right it's awkward right now.

On Wed, Aug 8, 2018 at 12:50 PM Mickey Reiss [email protected] wrote:

That works, but I can’t figure out how to combine order and limit to produce a reversed feed. For example, this is useful in a chat interface, where I want to render the 30 latest messages, newest on bottom.

It would be helpful if the data source had an option to reverse the data source.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-iOS/issues/491#issuecomment-411530327, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEw6uKMQJOQ9TF-zlYcH5Svsr04cYgrks5uO0EDgaJpZM4VlZpB .

samtstern avatar Aug 08 '18 20:08 samtstern

@samtstern Anything to share on plans for this feature? We are currently using a wrapper library called Pring which adds support for this.

mickeyreiss avatar Aug 16 '18 19:08 mickeyreiss

I wrote a drop-in replacement in Swift for FUIBatchedArray and FUIFirestoreCollectionViewDataSource that supports filtering if anybody needs that functionality right now. I want to implement map as well, but I'm not quite sure how to or if I should modify a DocumentSnapshot.

red42 avatar Oct 02 '18 19:10 red42