How can I create a local document in Couchbase Lite?

Hi,

from docs I can’t understand as specify that a document is “local” while creating it.

Do I have to create doc with standard getDocument() method and then add properties to it via putLocalDocument()?

Thanks.
P

Found solution by myself browsing source code: putLocalDocument() creates itself the document appending "local/" to the ID you provide, then getExistingLocalDocument() directly retrieves doc properties.

The fact that there’s a local/ prefix is purely an internal implementation detail; it has nothing to do with the API.

Just call putLocalDocument even though the document doesn’t exist yet; it will be created.

(Also, I’m not sure what you’re using this for; most apps don’t need to use local docs. They’re just for storing some state in the database that won’t be replicated. We’re removing this feature in 2.0 because it’s rarely used and complicates the API.)

Thanks for confirming that. In effect, using a dedicated not synced db was the first hipotesys. Will move to this solution to eventually simplify transition to 2.0.