couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Copenhaver <sean.copenha...@gmail.com>
Subject Re: How to update just a field
Date Fri, 25 Jan 2013 21:26:06 GMT
You honestly can't. Not really. JSON isn't really made to be an update in
place data format. It's generally read in it's entirety, operated on, then
written back out in it's entirety. This does give every operation sort of a
document level transaction semantic. The closest you can come is an update
handler [1] to perform the task completely on the server, but it's still
the same workflow.

[1] http://docs.couchdb.org/en/latest/ddocs/#update-functions


On Fri, Jan 25, 2013 at 3:58 PM, Jaisol <jaisol@hotmail.com> wrote:

> Hi,
>
> I've added one document to my db.
>
> # cat file.json
> {
>    "docs": [
>       {
>          "_id": "prod",
>          "sysAdmins": [
>             "admin",
>             "sys_admin"
>          ],
>          "webDeploy": {
>             "source": "server1.domain.com",
>             "username": "myUser",
>             "password": "xxxxxx",
>             "websites": {
>                "site1.domain.com": {
>                   "path": "d:\\websites\\site1.domain.com",
>                   "appPoolIdentity": "domain\\sys_site1"
>                },
>                "site2.domain.com": {
>                   "path": "d:\\websites\\site2.domain.com",
>                   "appPoolIdentity": "domain\\sys_site2"
>                }
>             }
>          }
>       }
>    ]
> }
>
> #curl -d @file.json -X POST http://localhost/mydb/_bulk_docs -H
> "Content-Type:
> application/json"
> [{"id":"prod","rev":"1-a4f83f088384ea39ad593e4b4c2f7018"}]
>
>
> I'm so new on this.
> I've read the HTTP API and I still don't figure out how to update or
> delete just
> one field.
> 1. Update the webDeploy field ?
> 2. Delete the sysAdmins field ?
>
> Sorry to bother you with a newbie question.
>
> Any advice is greatly appreciated. Thanks!
>
>


-- 
“The limits of language are the limits of one's world. “ - Ludwig von
Wittgenstein

"Water is fluid, soft and yielding. But water will wear away rock, which is
rigid and cannot yield. As a rule, whatever is fluid, soft and yielding
will overcome whatever is rigid and hard. This is another paradox: what is
soft is strong." - Lao-Tzu

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message