couchdb-net icon indicating copy to clipboard operation
couchdb-net copied to clipboard

DocumentId with slash

Open mauro-rogledi opened this issue 1 year ago • 0 comments

If a document ID contains slash, the saved document is incorrect.

Example:

var mockData = new MockData()
{
    Id="1/bis",
    itemCode = "123/456",
    description = "Id with slash"
};

var _client = new CouchClient("http://localhost:5984", c =>
c.UseBasicAuthentication("admin", "admin"));
var couchInventory = await _client.GetOrCreateDatabaseAsync<MockData>();

await couchInventory.AddOrUpdateAsync(mockData);

The resulting document on CouchDB will be:

{
  "_id": "1",
  "_rev": "7-04057498ac9aa09f84230be53415b3e5",
  "_attachments": {
    "bis": {
      "content_type": "application/json; charset=UTF-8",
      "revpos": 1,
      "digest": "md5-7vWis1l5PCY91TEq7KmMhQ==",
      "length": 100,
      "stub": true
    }
  }
}

mauro-rogledi avatar Aug 09 '22 08:08 mauro-rogledi