Couchbase lite data storing path

房东的猫 提交于 2019-12-12 03:49:58

问题


I am using couchbase lite for my Windows application, I want to know the place where Document created by code are going to be stored.


回答1:


As of 2018 you can specify the location of a database when you connect to it. According to the docs:

The DatabaseConfiguration.Database property Gets or sets the directory to use when creating or opening the data.

So when you create the Database object, the constructor "Creates a database with a given name and database configuration. If the configuration is null then the default configuration will be used. If the database does not yet exist, it will be created."

var database = new Database("mydb", new DatabaseConfiguration(){Database="mylocation/dbname"}); 

This is rough code but you get the idea.

If you do not specify a directory path when you create a db then it goes in a default directory in your local user space, for Windows this is explained in this SO page




回答2:


The location is determined by the JavaContext you pass when you create a new Manager object.

The default is a subdirectory named "cblite", or you can pass a String arg when you create the JavaContext instance.

If the path you supply is not absolute, the location is relative to the working directory of the application.



来源:https://stackoverflow.com/questions/39016745/couchbase-lite-data-storing-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!