You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Alexander Shorin (JIRA)" <ji...@apache.org> on 2012/06/08 01:17:23 UTC

[jira] [Created] (COUCHDB-1494) %00 document _id.

Alexander Shorin created COUCHDB-1494:
-----------------------------------------

             Summary: %00 document _id.
                 Key: COUCHDB-1494
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1494
             Project: CouchDB
          Issue Type: Bug
          Components: Database Core
    Affects Versions: 1.3
            Reporter: Alexander Shorin


There is possible to create document with null byte _id:

curl -X PUT http://localhost:5984/invis/%00 -H "Content-Type: application/json" -d '{"I am":"invincible man!"}'

Every thing is ok with such document: you could access to him by %00 name, process him in views and ever replicate without problem.

Fun begins when such document receives first update:

curl -X PUT http://localhost:5984/invis/%00 -H "Content-Type: application/json" -d '{"I am":"invincible man!", "_rev": "1-41c7e2af5d2154c4f33de3f76451417e"}'

Now replicator tells that he done his job right:

{
"session_id":"eb01826560247c82dff704388793a505",
"start_time":"Thu, 07 Jun 2012 23:01:30 GMT",
"end_time":"Thu, 07 Jun 2012 23:01:30 GMT",
"start_last_seq":0,
"end_last_seq":1,
"recorded_seq":1,
"missing_checked":1,
"missing_found":1,
"docs_read":1,
"docs_written":1,
"doc_write_failures":0
}

But actually he didn't:

curl -X GET http://localhost:5984/invis2/_all_docs
{
"total_rows":1,
"offset":0,
"rows":[
  {
    "id":"_design/_replicator",
    "key":"_design/_replicator",
    "value":{"rev":"1-5bfa2c99eefe2b2eb4962db50aa3cfd4"}
  }
]}

And document does not ever exists:

curl -X GET http://localhost:5984/invis2/%00
{"error":"not_found","reason":"missing"}

Attempt to recreate him now fails with weird explanation:

curl -X PUT http://localhost:5984/invis2/%00 -H "Content-Type: application/json" -d '{"foo":"bar"}'
{"error":"forbidden","reason":"The `source' property must exist and be either a string or an object."}

This issue is similar to COUCHDB-1493, but mostly focused on invalid doc _id case and related operations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira