couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Le Brasseur <johnlebrass...@gmail.com>
Subject Re: Getting, editing and (re-)Posting docs to update them:
Date Mon, 13 Feb 2017 13:55:04 GMT
Mmmm!
I think  (python)json.tool in Vim put each doc's contents in alphabetical
order, not CouchDB. Is there a way of forcing json.tool NOT to sort??
Can't find it so far.

On 13 February 2017 at 14:39, John Le Brasseur <johnlebrasseur@gmail.com>
wrote:

> Thanks Joan.
> Thanks especially for the tip that _all_docs is a view!!
> I am working on this matter, but find the GET docs are also sorted
> alphabetically which is irritating as the original docs had a sequence for
> a reason. Is there a way to avoid the sorting of the output.
> I presume once updated the order is permanent.
>
>
> On 12 February 2017 at 22:42, Joan Touzet <wohali@apache.org> wrote:
>
>> Hi John,
>>
>> The standard procedure generally is a GET-modify-PUT cycle, one document
>> at a time.
>>
>> Remember that _all_docs is basically a built in view. You're presumably
>> adding include_docs=true to that view request to get the format you're
>> seeing (or your client is doing this for you).
>>
>> A simple:
>>
>> doc = doc.doc
>>
>> or equivalent in your language should limit scope to just the document
>> itself.
>>
>> Good luck,
>> Joan
>>
>> ----- Original Message -----
>> > From: "John Le Brasseur" <johnlebrasseur@gmail.com>
>> > To: user@couchdb.apache.org
>> > Sent: Sunday, February 12, 2017 10:19:42 AM
>> > Subject: Getting, editing and (re-)Posting docs to update them:
>> >
>> > Hi.
>> > I am getting(GET) all the docs from my database in order to try and
>> > update
>> > certain data in all of them and then POST the edited docs to update
>> > the
>> > database.
>> >
>> >
>> > However, the documents contain extra data which looks like this:
>> >
>> >  "id": "d8d006c66c0e4555bf12e5d086003010",
>> >       "key": "d8d006c66c0e4555bf12e5d086003010",
>> >       "value": {
>> >         "rev": "28-38526f3787b1fcedc82624419709c347"
>> >       },
>> >       "doc": { ....
>> >
>> >
>> > This is followed by the actual document:
>> >
>> >  "_id": "d8d006c66c0e4555bf12e5d086003010",
>> >  "_rev": "28-38526f3787b1fcedc82624419709c347",
>> >         ...........etc.
>> >
>> >
>> >
>> > Is there a way to get output without this data added?
>> >
>> > If not I presume one must remove this manually every time one wishes
>> > to
>> > edit documents.
>> >
>> > Many thanks.
>> >
>> > John
>> >
>>
>
> John
>
>
>

John

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