Skip to content

Replication : add "create_target" field #189

Closed
@cfeltz34

Description

@cfeltz34

When a create a new replication (database doesn't exist), I want to set CouchDB attribute "create_target": true.

Can you just add membre in CouchReplication class :

[DataMember]
[JsonProperty("create_target")]
public bool CreateTarget{ get; set; }

Usage :

string couchDBUrl = "http://localhost:5984/"; // Url from CouchDB server
string username = _tokenDecode.GetUsername();
string userCouchDBName = couchDBUrl + username + "_data";

// Looking for existance of this database
await _couchDBContext.Client.ReplicateAsync(
    source: couchDBUrl + _couchDBContext.DatabaseName, 
    target: userCouchDBName, 
    replication: new CouchReplication() { 
        SourceCredentials = new CouchReplicationBasicCredentials(
            _apiConfiguration.CouchDBLogin, _apiConfiguration.CouchDBPassword
        ),
        TargetCredentials = new CouchReplicationBasicCredentials(
            _apiConfiguration.CouchDBLogin, _apiConfiguration.CouchDBPassword
        ),
        Continuous = true, 
        Selector = new { owner = username } 
    }
);

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions