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/08/13 13:03:37 UTC

Is it good idea put many(100 000) big attachments to single doc?

Hi guy's.
I have idea keep all attachments in separate db, separate from docs
(its allow me replicate only docs without attachments),
and in doc save link to attachment in separate db.

is it possible put many(100 000) big attachments to single doc?
Thanks for help!

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 14 August 2010 00:23, faust 1111 <fa...@gmail.com> wrote:
> Yes it's possible but each time when i put attachment i must create
> new doc and remember doc id +attachment_name
> if i keep all attachments in one doc i can remember only
> attachment_name, its simple.

You know you can set your own uuids (doc._id) when you POST the
attachment, right?

So you can keep them whereever you like, use the original name as uuid
(maybe some hash function if you have unusual characters) and easy to
find/refer to.

Will that work for you?

A+
Dave

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Noah Slater <ns...@apache.org>.
Figure out what the primary key is, and use that as the document name, then.

On 13 Aug 2010, at 14:37, faust 1111 wrote:

>> Why not just use the attachment name as the document id?
> Docs name can be not uniq.
> 
> 
> 
> 2010/8/13 Mark J. Reed <ma...@gmail.com>:
>> Why not just use the attachment name as the document id?  You could
>> double it up or just use an unchanging name for the actual Couch
>> attachment identifier, e.g.
>> 
>> /docs/mycoolattachment1/content
>> /docs/anotherniftyattachment/content
>> ...
>> 
>> 
>> 
>> 
>> On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
>>> Yes it's possible but each time when i put attachment i must create
>>> new doc and remember doc id +attachment_name
>>> if i keep all attachments in one doc i can remember only
>>> attachment_name, its simple.
>>> 
>>> 
>>> 2010/8/13 Noah Slater <ns...@apache.org>:
>>>> What about a separate db for your attachments, with one attachment per doc?
>>>> 
>>>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>>> 
>>>>> Hi guy's.
>>>>> I have idea keep all attachments in separate db, separate from docs
>>>>> (its allow me replicate only docs without attachments),
>>>>> and in doc save link to attachment in separate db.
>>>>> 
>>>>> is it possible put many(100 000) big attachments to single doc?
>>>>> Thanks for help!
>>>> 
>>>> 
>>> 
>> 
>> 
>> 
>> --
>> Mark J. Reed <ma...@gmail.com>
>> 


Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Noah Slater <ns...@apache.org>.
What is your primary key?

On 13 Aug 2010, at 14:49, faust 1111 wrote:

>> If you mean the attachment names aren't unique, how were you going to
>> attach them all to a single couch doc?
> 
> Yes dude)
> Have no choice, need separate docs per attachment.
> 
> 
> 
> 2010/8/13 Mark J. Reed <ma...@gmail.com>:
>> On Fri, Aug 13, 2010 at 9:37 AM, faust 1111 <fa...@gmail.com> wrote:
>>>> Why not just use the attachment name as the document id?
>>> Docs name can be not uniq.
>> If you mean the attachment names aren't unique, how were you going to
>> attach them all to a single couch doc?
>> 
>>> 2010/8/13 Mark J. Reed <ma...@gmail.com>:
>>>> Why not just use the attachment name as the document id?  You could
>>>> double it up or just use an unchanging name for the actual Couch
>>>> attachment identifier, e.g.
>>>> 
>>>> /docs/mycoolattachment1/content
>>>> /docs/anotherniftyattachment/content
>>>> ...
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
>>>>> Yes it's possible but each time when i put attachment i must create
>>>>> new doc and remember doc id +attachment_name
>>>>> if i keep all attachments in one doc i can remember only
>>>>> attachment_name, its simple.
>>>>> 
>>>>> 
>>>>> 2010/8/13 Noah Slater <ns...@apache.org>:
>>>>>> What about a separate db for your attachments, with one attachment per doc?
>>>>>> 
>>>>>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>>>>> 
>>>>>>> Hi guy's.
>>>>>>> I have idea keep all attachments in separate db, separate from docs
>>>>>>> (its allow me replicate only docs without attachments),
>>>>>>> and in doc save link to attachment in separate db.
>>>>>>> 
>>>>>>> is it possible put many(100 000) big attachments to single doc?
>>>>>>> Thanks for help!
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Mark J. Reed <ma...@gmail.com>
>>>> 
>>> 
>> 
>> 
>> 
>> --
>> Mark J. Reed <ma...@gmail.com>
>> 


Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by faust 1111 <fa...@gmail.com>.
>If you mean the attachment names aren't unique, how were you going to
>attach them all to a single couch doc?

Yes dude)
Have no choice, need separate docs per attachment.



2010/8/13 Mark J. Reed <ma...@gmail.com>:
> On Fri, Aug 13, 2010 at 9:37 AM, faust 1111 <fa...@gmail.com> wrote:
>>>Why not just use the attachment name as the document id?
>> Docs name can be not uniq.
> If you mean the attachment names aren't unique, how were you going to
> attach them all to a single couch doc?
>
>> 2010/8/13 Mark J. Reed <ma...@gmail.com>:
>>> Why not just use the attachment name as the document id?  You could
>>> double it up or just use an unchanging name for the actual Couch
>>> attachment identifier, e.g.
>>>
>>> /docs/mycoolattachment1/content
>>> /docs/anotherniftyattachment/content
>>> ...
>>>
>>>
>>>
>>>
>>> On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
>>>> Yes it's possible but each time when i put attachment i must create
>>>> new doc and remember doc id +attachment_name
>>>> if i keep all attachments in one doc i can remember only
>>>> attachment_name, its simple.
>>>>
>>>>
>>>> 2010/8/13 Noah Slater <ns...@apache.org>:
>>>>> What about a separate db for your attachments, with one attachment per doc?
>>>>>
>>>>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>>>>
>>>>>> Hi guy's.
>>>>>> I have idea keep all attachments in separate db, separate from docs
>>>>>> (its allow me replicate only docs without attachments),
>>>>>> and in doc save link to attachment in separate db.
>>>>>>
>>>>>> is it possible put many(100 000) big attachments to single doc?
>>>>>> Thanks for help!
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Mark J. Reed <ma...@gmail.com>
>>>
>>
>
>
>
> --
> Mark J. Reed <ma...@gmail.com>
>

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by "Mark J. Reed" <ma...@gmail.com>.
On Fri, Aug 13, 2010 at 9:37 AM, faust 1111 <fa...@gmail.com> wrote:
>>Why not just use the attachment name as the document id?
> Docs name can be not uniq.
If you mean the attachment names aren't unique, how were you going to
attach them all to a single couch doc?

> 2010/8/13 Mark J. Reed <ma...@gmail.com>:
>> Why not just use the attachment name as the document id?  You could
>> double it up or just use an unchanging name for the actual Couch
>> attachment identifier, e.g.
>>
>> /docs/mycoolattachment1/content
>> /docs/anotherniftyattachment/content
>> ...
>>
>>
>>
>>
>> On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
>>> Yes it's possible but each time when i put attachment i must create
>>> new doc and remember doc id +attachment_name
>>> if i keep all attachments in one doc i can remember only
>>> attachment_name, its simple.
>>>
>>>
>>> 2010/8/13 Noah Slater <ns...@apache.org>:
>>>> What about a separate db for your attachments, with one attachment per doc?
>>>>
>>>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>>>
>>>>> Hi guy's.
>>>>> I have idea keep all attachments in separate db, separate from docs
>>>>> (its allow me replicate only docs without attachments),
>>>>> and in doc save link to attachment in separate db.
>>>>>
>>>>> is it possible put many(100 000) big attachments to single doc?
>>>>> Thanks for help!
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Mark J. Reed <ma...@gmail.com>
>>
>



-- 
Mark J. Reed <ma...@gmail.com>

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by faust 1111 <fa...@gmail.com>.
>Why not just use the attachment name as the document id?
Docs name can be not uniq.



2010/8/13 Mark J. Reed <ma...@gmail.com>:
> Why not just use the attachment name as the document id?  You could
> double it up or just use an unchanging name for the actual Couch
> attachment identifier, e.g.
>
> /docs/mycoolattachment1/content
> /docs/anotherniftyattachment/content
> ...
>
>
>
>
> On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
>> Yes it's possible but each time when i put attachment i must create
>> new doc and remember doc id +attachment_name
>> if i keep all attachments in one doc i can remember only
>> attachment_name, its simple.
>>
>>
>> 2010/8/13 Noah Slater <ns...@apache.org>:
>>> What about a separate db for your attachments, with one attachment per doc?
>>>
>>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>>
>>>> Hi guy's.
>>>> I have idea keep all attachments in separate db, separate from docs
>>>> (its allow me replicate only docs without attachments),
>>>> and in doc save link to attachment in separate db.
>>>>
>>>> is it possible put many(100 000) big attachments to single doc?
>>>> Thanks for help!
>>>
>>>
>>
>
>
>
> --
> Mark J. Reed <ma...@gmail.com>
>

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by "Mark J. Reed" <ma...@gmail.com>.
Why not just use the attachment name as the document id?  You could
double it up or just use an unchanging name for the actual Couch
attachment identifier, e.g.

/docs/mycoolattachment1/content
/docs/anotherniftyattachment/content
...




On Fri, Aug 13, 2010 at 8:23 AM, faust 1111 <fa...@gmail.com> wrote:
> Yes it's possible but each time when i put attachment i must create
> new doc and remember doc id +attachment_name
> if i keep all attachments in one doc i can remember only
> attachment_name, its simple.
>
>
> 2010/8/13 Noah Slater <ns...@apache.org>:
>> What about a separate db for your attachments, with one attachment per doc?
>>
>> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>>
>>> Hi guy's.
>>> I have idea keep all attachments in separate db, separate from docs
>>> (its allow me replicate only docs without attachments),
>>> and in doc save link to attachment in separate db.
>>>
>>> is it possible put many(100 000) big attachments to single doc?
>>> Thanks for help!
>>
>>
>



-- 
Mark J. Reed <ma...@gmail.com>

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Filipe David Manana <fd...@apache.org>.
On Fri, Aug 13, 2010 at 1:23 PM, faust 1111 <fa...@gmail.com> wrote:

> Yes it's possible but each time when i put attachment i must create
> new doc and remember doc id +attachment_name
> if i keep all attachments in one doc i can remember only
> attachment_name, its simple.
>

If you do a PUT /dbname/docname/attachment.whatever  (attachment standalone
API) it will create the document if it doesn't exist already. The doc will
be empty, but maybe it's not an issue for your case.


>
>
> 2010/8/13 Noah Slater <ns...@apache.org>:
> > What about a separate db for your attachments, with one attachment per
> doc?
> >
> > On 13 Aug 2010, at 12:03, faust 1111 wrote:
> >
> >> Hi guy's.
> >> I have idea keep all attachments in separate db, separate from docs
> >> (its allow me replicate only docs without attachments),
> >> and in doc save link to attachment in separate db.
> >>
> >> is it possible put many(100 000) big attachments to single doc?
> >> Thanks for help!
> >
> >
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by faust 1111 <fa...@gmail.com>.
Yes it's possible but each time when i put attachment i must create
new doc and remember doc id +attachment_name
if i keep all attachments in one doc i can remember only
attachment_name, its simple.


2010/8/13 Noah Slater <ns...@apache.org>:
> What about a separate db for your attachments, with one attachment per doc?
>
> On 13 Aug 2010, at 12:03, faust 1111 wrote:
>
>> Hi guy's.
>> I have idea keep all attachments in separate db, separate from docs
>> (its allow me replicate only docs without attachments),
>> and in doc save link to attachment in separate db.
>>
>> is it possible put many(100 000) big attachments to single doc?
>> Thanks for help!
>
>

Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Noah Slater <ns...@apache.org>.
What about a separate db for your attachments, with one attachment per doc?

On 13 Aug 2010, at 12:03, faust 1111 wrote:

> Hi guy's.
> I have idea keep all attachments in separate db, separate from docs
> (its allow me replicate only docs without attachments),
> and in doc save link to attachment in separate db.
> 
> is it possible put many(100 000) big attachments to single doc?
> Thanks for help!


Re: Is it good idea put many(100 000) big attachments to single doc?

Posted by Benoit Chesneau <bc...@gmail.com>.
On Fri, Aug 13, 2010 at 1:03 PM, faust 1111 <fa...@gmail.com> wrote:
> Hi guy's.
> I have idea keep all attachments in separate db, separate from docs
> (its allow me replicate only docs without attachments),
> and in doc save link to attachment in separate db.
>
> is it possible put many(100 000) big attachments to single doc?
> Thanks for help!
>

No the string loaded will be too long and CouchDB will hangs on this.
Better to separate attachments.

- benoit