> On Oct 31, 2014, at 3:42 AM, Nithin Haridas <[email protected]> wrote: > > We have been using couchbase lite in IOS for analytics, where the device > pushes data to the server (one way only). > There is a lot of data that gets logged that is not going to be useful once > it is replicated on the server.
This is actually a use case that I tell people Couchbase Lite isn't very well suited for. The replication protocol is designed to handle bidirectional replication, between many peers, of mutable documents that are frequently modified. Data collection is a much simpler application that doesn't need any of those features, so replication adds a fair amount of overhead. On the other hand, I don't know of any off-the-shelf engine that does only what you need (the store-and-forward part is still nontrivial) so CBL may still be worth it for you. > Delete the local database and re-create it and all connected replications. That's a fine way to do it, assuming the replication really is push-only; otherwise the new database will have to pull data from the server again. One workaround is to use two databases, with one of them containing only the ephemeral docs you want to send to the server. Then you only need to delete and recreate that one. > • Purge the documents, once replication is stopped. As you point out, this can take a while. Even if you run it on a background thread, it blocks access to the database file while it's going on, so you can't do anything else with that database on any thread until it finishes. (This is a limitation of SQLite, which only allows a single writer.) The more frequently you purge, though, the less stuff there is to get rid of, so the less time it takes. Overall it sounds like the two-databases approach, where you frequently delete one, would be the best. —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/11F37C5C-4E95-4D76-9A1A-80C03E0F96E6%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
