Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2
    • Component/s: Database Core
    • Labels:
    • Environment:

      linux

    • Skill Level:
      New Contributors Level (Easy)

      Description

      When PUTting a document you have to specify the current revision as a _rev key in the JSON; whereas many related requests (like DELETE, COPY and PUT of an attachment) specify the revision in a "?rev=" URL query parameter instead. The first example, will result into a document conflict because rev is not specified in the JSON and the rev from the url gets ignored. All other examples work. I strongly believe JSON bodies like this should never contain _id and _rev and will improve in much better client code.

      curl -X PUT http://localhost:5984/_users/user%3Agert?rev=5xxx -H
      'Content-Type: application/json' -d{
      "_id" : "user:gert",
      "type" : "user",
      "name" : "gert",
      "roles" : [],
      "password_sha" : "",
      "salt" : ""
      }'

      curl -X PUT http://localhost:5984/_users/user%3Agert -H 'Content-Type:
      application/json' -d{
      "_id" : "user:gert",
      "_rev":"5xxx",
      "type" : "user",
      "name" : "gert",
      "roles" : [],
      "password_sha" : "",
      "salt" : ""
      }'

      curl -X PUT http://localhost:5984/_users/user%3Agert/picture?rev=5xxx
      -H 'Content-Type: image/png' -d @picture.png

        Attachments

          Activity

            People

            • Assignee:
              tilgovi Randall Leeds
              Reporter:
              gert gert cuykens
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified