问题
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