Limiting results for Query-based synchronisation


#1

Hi!

In the docs for the database we learn that:

Since queries in Realm are lazy, performing this sort of paginating behavior isn’t necessary at all, as Realm will only load objects from the results of the query once they are explicitly accessed.

Is this also true for query-based synchronization for the platform? Better explaining myself, If I subscribe to a query that has 100 results but instead of iterating over the results I only call first(), would the entire 100 results be download to the device or just 1?

Thanks!


#2

@Diogo The subscription will determine what is saved to the realm file on the local disk (in your case 100 results). From there the lazy-loading is used to access the first() from the local realm.