couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon <tsr2...@gmail.com>
Subject inconsistent behavior in _all_docs with deleted documents
Date Mon, 14 Feb 2011 19:08:25 GMT
Hello,

I noticed a change in behavior from 1.0.1 to 1.1.x regarding _all_docs 
and deleted documents.

I've got a series of cURL commands that reproduce the "issue" for me.

curl -XPUT http://localhost:5984/test_20110214
curl -XPUT -d '{"_id":"foo","data":"bar"}' -H'Content-Type: application/json' http://localhost:5984/test_20110214/foo
curl -XDELETE http://localhost:5984/test_20110214/foo?rev=<rev>
curl -XPOST -d'{"keys":["foo"]}' -H'Content-Type: application/json' http://localhost:5984/test_20110214/_all_docs?include_docs=true

and you'll obviously need to replace <rev> with the revision returned by 
the previous command.

On 1.0.1, this results in something like the following:

{"total_rows":0,"offset":0,"rows":[
{"id":"foo","key":"foo","value":{"rev":"2-21a02b631e42e652c8ef52da9b156997","deleted":true},"doc":null}
]}

However, on 1.1.x, this results in something like the following:

{"total_rows":0,"offset":0,"rows":[
{"id":"foo","key":"foo","value":{"rev":"2-21a02b631e42e652c8ef52da9b156997","deleted":true},"doc":{"_id":"foo","_rev":"2-21a02b631e42e652c8ef52da9b156997","_deleted":true}}
]}

Note that instead of 'null', 1.1.x actually returns a stub document with 
_deleted set to 'true'.

I'm not sure if this is change in behavior is expected or not, but I 
didn't want to file a bug report without checking with the list first.

The second question this led me to: do we want to return any rows at 
all? I noticed that "total_rows" is 0 in both cases, yet there is 1 row 
returned.

Thanks for your time and any insight you can provide.

Mime
View raw message