CBL Without Sync

38 views
Skip to first unread message

Systematic Frank

unread,
Feb 8, 2014, 9:32:42 AM2/8/14
to mobile-c...@googlegroups.com
Recently I have come to a case where CBL is highly desirable not because the replication, but because of the great json/dictionary based views and map-reduce.

Sometime ago I discovered that some features had a default behavior that could not be changed. In the case where I do not care about replication, I would like to disable:

1. previous document versions 
2. not keeping around deleted documents
3. any extra thing needed for server sync that I am forgetting now

The documents will have some attached files, not very big, but considerable if unnecessary past versions are kept and never synced.

Basically I want a dumb down CBL. Something like sqlite with json + views + mapreduce. Will I be able to fine tune CBL to have this behavior? 

Jens Alfke

unread,
Feb 8, 2014, 3:49:44 PM2/8/14
to mobile-c...@googlegroups.com
On Feb 8, 2014, at 6:32 AM, Systematic Frank <pub...@francisco-garcia.net> wrote:

Recently I have come to a case where CBL is highly desirable not because the replication, but because of the great json/dictionary based views and map-reduce.

Ha! That's flattering — sometimes I think that the only reason people put up with the low-level nature of map/reduce, instead of fancy SQL queries, is because they need the sync features :)

Sometime ago I discovered that some features had a default behavior that could not be changed. In the case where I do not care about replication, I would like to disable:
1. previous document versions 

You can now accomplish something close to that by changing the database's .maxRevTreeDepth property, which controls the number of old revisions that it will keep track of. (This refers to the metadata, not the document bodies; non-current doc bodies always get deleted during compaction, but the metadata of old revisions normally stays around to help with conflict resolution.)

You should be able to set db.maxRevTreeDepth to 1, and all old revision data will get deleted whenever you compact the database. It won't be quite as lightweight as it could be, because the old revisions do get kept until the compaction occurs, but it should be OK.

2. not keeping around deleted documents

You can do this by purging a document immediately after deleting it. But there's no mode that would make this happen automatically.

—Jens
Reply all
Reply to author
Forward
0 new messages