Hi all,
Just wondering if this is expected behaviour.
When using COPY with _local documents and the Destination header contains a
document identifier that does not start with _local then the document
appears to be copied without the copied document identifier starting with
_local/, ie, the copied document is no longer local, it is a regular
document.
If the destination id starts with _local then it is copied as a local
document.
As the API call is COPY /{db}_local/{docid} I would expect it to only copy
to another local document.
I imagine this is by design but I find it a little counter-intuitive and a
possible way to end up replicating documents inadvertently.
The full request/response log looks like:
[COPY] http://localhost:5984/mock%2Fdatabase/_local/mock%2Fdocument
{
"destination": "mock/document/copy",
"accept": "application/json",
"host": "localhost:5984"
}
[201] http://localhost:5984/mock%2Fdatabase/_local/mock%2Fdocument
{
"server": "CouchDB/1.6.0 (Erlang OTP/R15B03)",
"location": "http://localhost:5984/mock/database/mock/document/copy",
"etag": "\"9-0c29f3ff80cdf5234680c1f670653388\"",
"date": "Wed, 27 Aug 2014 06:09:50 GMT",
"content-type": "application/json",
"content-length": "81",
"cache-control": "must-revalidate"
}
{
"ok": true,
"id": "mock/document/copy",
"rev": "9-0c29f3ff80cdf5234680c1f670653388"
}
Also just looking at the response log again, the Location of the new
document has not encoded the {db} {docid} parameters which makes the
Location header unusable in this situation.
Any help/clarification much appreciated.
--
mischa (aka muji).