After purge on document and compact on database, all document are getting downloaded in next pull replication

I am new to couchbase lite. I am trying to clear the disk space used by my database after some day. I am using purge on document and compact on database instance for the same. But when I am monitoring the changescount(using pull.getChangesCount()) in Replication.ChangeListener, it looks like all document are again downloaded to local SQLite.

Purge will reset the database as if it never received the document in the first place, so if another change comes in for the document you purged then it will receive it again. Without some more information on your environment I can’t say anything more specific but it’s not out of the realm of possibility at all that this would happen.

Thanks for the reply. I think I may be confused on the purpose of below methods of Replication class:
getCompletedChangesCount() - total count of document and its revision received
getChangesCount() – total count of document and its revision processed

can you please confirm if my understanding is correct.

Also even after purge being called when I am opening sqllite file in notepad++, I can still do a search on the file and find the document.

Also do we know if we can set up userd id and password for SQLite to prevent unauthorized access.

SQLite is not a client/server system so there’s no such thing as a username; the database is simply a file.

The Enterprise Edition of Couchbase Lite supports database encryption, which does allow you to protect the database with a password [or a raw AES256 key].

Thanks Jens. Can you please provide your feedback on others questions.

You’re correct about the meanings of those methods. Did you understand @borrrden’s point?

Also even after purge being called when I am opening sqllite file in notepad++, I can still do a search on the file and find the document.

You’re looking at the database file with a text editor?! Use the sqlite3 command-line tool instead; it will let you view the database properly. The raw contents of the file might still contain some deleted data in an empty or partially-used page.