Atachments and related document in queries during replication

22 views
Skip to first unread message

Martin Palatnik

unread,
Oct 23, 2014, 5:43:06 PM10/23/14
to mobile-c...@googlegroups.com
Hi,

I'm having an issue. I don't want to lock the user while the system is making the initial replication (as it takes too long).
However when I don't do that, if the user performs a query and the a document has attachments and related documents that where still not replicated the app behaves weirdly as expected.

1) Is there a way to delay a row from appearing in the results until the related docd and attachments are replicated?
2) Is there a way to provide a temporary placeholder until the related docd and attachments are replicated?
3) Is there to tell a live query to update once the attachment and related docs are replaicated?

I'm particularly interested in the first use case. 
If there isn't which strategy would you recommend to do that? I guess something around observing the properties?

Cheers, and thanks for the great work,
Martin



Jens Alfke

unread,
Oct 23, 2014, 6:17:35 PM10/23/14
to mobile-c...@googlegroups.com
On Oct 23, 2014, at 2:43 PM, Martin Palatnik <mar...@gmail.com> wrote:

1) Is there a way to delay a row from appearing in the results until the related docd and attachments are replicated?

If you're on iOS and using 1.0.3 you can use the new CBLQuery.postFilter property, with an NSPredicate that runs a block that does the test.

2) Is there a way to provide a temporary placeholder until the related docd and attachments are replicated?

No.

3) Is there to tell a live query to update once the attachment and related docs are replaicated?

The live-query will re-run its query every time the database changes, but it won't trigger a notification unless the query results are different. However, if you're using the filter as described above, the results of the query will be different after the related docs appear, because the filter will stop removing the docs that are related to them. So it should work.

—Jens

Martin Palatnik

unread,
Oct 23, 2014, 8:44:32 PM10/23/14
to mobile-c...@googlegroups.com
That's a nice timing for the 1.0.3 .. I will try your suggestion. Thanls
Reply all
Reply to author
Forward
0 new messages