You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by faust 1111 <fa...@gmail.com> on 2010/03/25 01:03:58 UTC
bulk Updates
if i follow
The CouchDB pattern would be something like:
1. Define a view that allows you to fetch the docs you want.
2. Fetch the docs, possibly using ?include_docs=true
3. Update the docs in the client
4. Push all the docs back using _bulk_docs
its will be to slow in my case
i have contents with authors:
content {
authors: [
{name: 'Lara', slug: 23424},
{name: 'Dimon', slug: 23445}
]
}
if author change name i must fetch 2000 docs and by hand change author
name in each doc
this is crazy job guy`s.
May be i`am thinking in wrong way?
please help.
Re: bulk Updates
Posted by Chris Anderson <jc...@gmail.com>.
Sent from my iPhone
On Mar 27, 2010, at 12:42 PM, Randall Leeds <ra...@gmail.com>
wrote:
> Not that this is a definitive answer, but this is what your music
> player
> does with id3 tags. It takes a long time to retag a bunch of music.
> Some
> things are by nature slow.
>
> On Mar 27, 2010 11:23 AM, "faust 1111" <fa...@gmail.com> wrote:
>
> Chris you think its o`key
> when i have 2000 Audio with same author
>
> and when i need update author name i need fetch 2000 audio when by
> hand find author in Array,
> and replace name?
>
It wouldn't have to be by hand. But it is a rare occurance so I
wouldn't stress about writing the bulk update code up front.
>
> 2010/3/27 Chris Anderson <jc...@gmail.com>:
>
>> In Taskr I copy the authors full profile (name, URL, gravatar image
>> URL)
> to
>> each task document. ...
Re: bulk Updates
Posted by Randall Leeds <ra...@gmail.com>.
Not that this is a definitive answer, but this is what your music player
does with id3 tags. It takes a long time to retag a bunch of music. Some
things are by nature slow.
On Mar 27, 2010 11:23 AM, "faust 1111" <fa...@gmail.com> wrote:
Chris you think its o`key
when i have 2000 Audio with same author
and when i need update author name i need fetch 2000 audio when by
hand find author in Array,
and replace name?
2010/3/27 Chris Anderson <jc...@gmail.com>:
> In Taskr I copy the authors full profile (name, URL, gravatar image URL)
to
> each task document. ...
Re: bulk Updates
Posted by faust 1111 <fa...@gmail.com>.
Chris you think its o`key
when i have 2000 Audio with same author
and when i need update author name i need fetch 2000 audio when by
hand find author in Array,
and replace name?
2010/3/27 Chris Anderson <jc...@gmail.com>:
> In Taskr I copy the authors full profile (name, URL, gravatar image URL) to
> each task document. This was a lot more relaxing than doing an additional
> lookup for each author.
>
> I have no plans to add a "change your name everywhere" feature, but it
> wouldn't be impossible.
>
> Chris
>
> Sent from my phone
>
> On Mar 24, 2010, at 9:03 PM, Randall Leeds <ra...@gmail.com> wrote:
>
>> I meant, do not store an author's name every where you reference it,
>> but store a uuid. The author's name then only appears in one place, on
>> the 'author' document.
>>
>> But this is very SQL like de-normalization. While it'd be great if
>> Couch can accommodate you, perhaps your needs are very relational.
>
Re: bulk Updates
Posted by Chris Anderson <jc...@gmail.com>.
In Taskr I copy the authors full profile (name, URL, gravatar image
URL) to each task document. This was a lot more relaxing than doing an
additional lookup for each author.
I have no plans to add a "change your name everywhere" feature, but it
wouldn't be impossible.
Chris
Sent from my phone
On Mar 24, 2010, at 9:03 PM, Randall Leeds <ra...@gmail.com>
wrote:
> I meant, do not store an author's name every where you reference it,
> but store a uuid. The author's name then only appears in one place, on
> the 'author' document.
>
> But this is very SQL like de-normalization. While it'd be great if
> Couch can accommodate you, perhaps your needs are very relational.
Re: bulk Updates
Posted by Randall Leeds <ra...@gmail.com>.
I meant, do not store an author's name every where you reference it,
but store a uuid. The author's name then only appears in one place, on
the 'author' document.
But this is very SQL like de-normalization. While it'd be great if
Couch can accommodate you, perhaps your needs are very relational.
Re: bulk Updates
Posted by faust 1111 <fa...@gmail.com>.
i means another case
i told: author change name and i must replace name in all related content.
2010/3/25 Randall Leeds <ra...@gmail.com>:
> When you have a new author, write that to a document. Use that
> document's id to reference it in other docs maybe?
>
> On Wed, Mar 24, 2010 at 17:03, faust 1111 <fa...@gmail.com> wrote:
>> if i follow
>>
>> The CouchDB pattern would be something like:
>>
>> 1. Define a view that allows you to fetch the docs you want.
>> 2. Fetch the docs, possibly using ?include_docs=true
>> 3. Update the docs in the client
>> 4. Push all the docs back using _bulk_docs
>>
>> its will be to slow in my case
>> i have contents with authors:
>> content {
>> authors: [
>> {name: 'Lara', slug: 23424},
>> {name: 'Dimon', slug: 23445}
>> ]
>> }
>>
>> if author change name i must fetch 2000 docs and by hand change author
>> name in each doc
>> this is crazy job guy`s.
>>
>> May be i`am thinking in wrong way?
>> please help.
>>
>
Re: bulk Updates
Posted by Randall Leeds <ra...@gmail.com>.
When you have a new author, write that to a document. Use that
document's id to reference it in other docs maybe?
On Wed, Mar 24, 2010 at 17:03, faust 1111 <fa...@gmail.com> wrote:
> if i follow
>
> The CouchDB pattern would be something like:
>
> 1. Define a view that allows you to fetch the docs you want.
> 2. Fetch the docs, possibly using ?include_docs=true
> 3. Update the docs in the client
> 4. Push all the docs back using _bulk_docs
>
> its will be to slow in my case
> i have contents with authors:
> content {
> authors: [
> {name: 'Lara', slug: 23424},
> {name: 'Dimon', slug: 23445}
> ]
> }
>
> if author change name i must fetch 2000 docs and by hand change author
> name in each doc
> this is crazy job guy`s.
>
> May be i`am thinking in wrong way?
> please help.
>
Re: bulk Updates
Posted by J Chris Anderson <jc...@gmail.com>.
On Mar 24, 2010, at 5:03 PM, faust 1111 wrote:
> if i follow
>
> The CouchDB pattern would be something like:
>
> 1. Define a view that allows you to fetch the docs you want.
> 2. Fetch the docs, possibly using ?include_docs=true
> 3. Update the docs in the client
> 4. Push all the docs back using _bulk_docs
>
> its will be to slow in my case
> i have contents with authors:
> content {
> authors: [
> {name: 'Lara', slug: 23424},
> {name: 'Dimon', slug: 23445}
> ]
> }
>
> if author change name i must fetch 2000 docs and by hand change author
> name in each doc
With a large number of matching docs, you'll want to do the updates in batches. If you have a view query that the asynchronous process is trying to empty, you can easily cope with updates that come in later (after the first pass of the batch is complete) by rerunning old rename queries a for some time window after the preference is updated.
I know it's not as simple as a SQL update, but it is compatible with multi-master replication and offline editing.
Chris
> this is crazy job guy`s.
>
> May be i`am thinking in wrong way?
> please help.