NPM's (node package manager) registry uses CouchDB to store meta information and tarballs of packages at a CouchDB instance at http://registry.npmjs.org/registry .. I use the following replication document (CouchDB 1.1.0) to replicate a subset of the registry to my corporate CouchDB:
{
"_id": "fetch-npm-registry",
"doc_ids": [
"coffee-script",
"nodeunit"
],
"source": "http://couchdb.mycompany.com:5984/registry",
"target": "registry",
}
[BTW, the CouchApp handling this is at https://github.com/isaacs/npmjs.org (also with complete installation instructions)].
If I want to add another dependency to one of my packages, my naive thought was I just amend the doc_ids list (say, to ["coffee-script", "nodeunit", "npm"]) and start the replication again.
This however doesn't work: The replication is finished immediately and the package I wanted to add to the replication (in this case "npm") is missing.
[The workaround known to me is to delete the target database, replicate again and - because I also use this local registry to publish my proprietary packages - re-publish my local packages. sigh]
Amendment 18.11.2011
Here's what I think what happens (not at all a CouchDB internals expert, but maybe there is some truth to it):
After the first successful replication, CouchDB stores the last (highest?) Sequence ID of the latest document it replicated in a hidden document in the database (I once knew how to access those, pointers welcome). Then, when I change the doc_ids this cached information about the last successful replication (the sequence ID) is not invalidated (or cleared). Then, when it's told to replicate again with the same database it compares the Sequence IDs and decides everything is fine.
npm publish) my own version of npm in the meantime. I have some packages that are original content (my proprietary ones) and the rest should be replicated from upstream. These two sets of packages are disjoint. - peritus