You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Benoit Chesneau <bc...@gmail.com> on 2009/04/13 13:20:25 UTC

using external to generate shortid ?

Hi,

For some project I need to generate short ids/name used in database. I
created a quick external to send shortid on each call. External use an
empty doc['shortcode'] which is saved each time the external is called
thend send bac the rev stem b62encoded. I then use the shortid across
documents.

http://www.friendpaste.com/ww5zr0XEK5qxO3mOEeGr3

But I wonder if it's enough to be sure 2 doc don't have same short id
for a node. In fact how are handled externals ? Does couchdb open a
process each time external is called or does it reuse it ? Does
couchdb open one external / guest connected to the db ? I would prefer
to store the sort increment in couchdb so I could do backup easyly.
What could be the other way to create  a short id ?


- benoit

Re: using external to generate shortid ?

Posted by Benoit Chesneau <bc...@gmail.com>.
2009/4/13 Paul Davis <pa...@gmail.com>:

>
> External servers use one process per node. All requests for all
> databases pass through the same OS process unless it dies in which
> case it's restarted.
>

 So I guess this script should work. Thanks for explanation.

- benoit

Re: using external to generate shortid ?

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Apr 13, 2009 at 7:20 AM, Benoit Chesneau <bc...@gmail.com> wrote:
> Hi,
>
> For some project I need to generate short ids/name used in database. I
> created a quick external to send shortid on each call. External use an
> empty doc['shortcode'] which is saved each time the external is called
> thend send bac the rev stem b62encoded. I then use the shortid across
> documents.
>
> http://www.friendpaste.com/ww5zr0XEK5qxO3mOEeGr3
>
> But I wonder if it's enough to be sure 2 doc don't have same short id
> for a node. In fact how are handled externals ? Does couchdb open a
> process each time external is called or does it reuse it ? Does
> couchdb open one external / guest connected to the db ? I would prefer
> to store the sort increment in couchdb so I could do backup easyly.
> What could be the other way to create  a short id ?
>
>
> - benoit
>

External servers use one process per node. All requests for all
databases pass through the same OS process unless it dies in which
case it's restarted.

HTH,
Paul Davis