couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Marca <>
Subject Re: copy docs from one db to another?
Date Mon, 25 Mar 2013 22:11:07 GMT
For a completely programming free approach, sometimes if I have, say
just 2 or 3 design docs, I'll open them up in futon in the browser in
separate tabs in the source view mode (so I can see the _rev field,
etc).  Then in yet another tab, I delete the database, and then create
create an empty database with the same name.  Then I go to each of the
tabs, edit the design docs to get rid of the "_rev" field, and click
save to write the design docs to the new db.

It works and does exactly the same thing as getting the designdocs to
a file, opening up the files, deleting the revision, and then using
curl to PUT the docs in the new database

I've tried the replication route too, but that got annoying pretty
fast.  Better for me was to have a clean db with design docs stored so
as to get a cannonical set of design docs without having to use my
file system, but then I would cut and paste the design doc source via
futon (create any old new document, replace its contents with the
design doc contents (less the revision number), and click save.  

Quick and dirty, but it works okay.


On Mon, Mar 25, 2013 at 02:49:04PM -0700, Mark Hahn wrote:
> thx
> On Mon, Mar 25, 2013 at 2:46 PM, Jens Alfke <> wrote:
> >
> > On Mar 25, 2013, at 2:35 PM, Mark Hahn <<mailto:
> >>> wrote:
> >
> > I have a database with a zillion docs that I need to empty.  I just want
> > the design docs left behind.
> >
> > If you delete the docs, you’ll leave behind tombstone revisions, so the
> > database won’t strictly speaking be empty (unless you call purge
> > afterwards.)
> >
> >  I googled and saw some techniques that
> > require writing code.
> > Could I just GET the docs with curl and then PUT them?
> >
> > The fastest way is probably
> > 1. Create a new database
> > 2. GET the design docs, PUT them to the new database
> > 3. Delete the old database
> > However you’ll be left with a database with a different name. I don’t
> > think there is any API to rename a database.
> >
> > —Jens
> >

View raw message