{"id":13554850,"url":"https://github.com/glynnbird/couchdiff","last_synced_at":"2025-03-21T12:32:03.098Z","repository":{"id":48025929,"uuid":"88969716","full_name":"glynnbird/couchdiff","owner":"glynnbird","description":"CouchDB/Cloudant diff tool - is database A different to database B?","archived":false,"fork":false,"pushed_at":"2024-07-31T11:50:33.000Z","size":242,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-14T09:41:20.414Z","etag":null,"topics":["cloudant","command-line","couchdb","diff","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glynnbird.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-21T09:54:37.000Z","updated_at":"2024-07-31T11:50:37.000Z","dependencies_parsed_at":"2024-04-26T08:47:19.790Z","dependency_job_id":"ae732e28-5784-4c4d-9986-eb789e730907","html_url":"https://github.com/glynnbird/couchdiff","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"c914cbe45694f674f06b9402aa9cd0e10da0195c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fcouchdiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fcouchdiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fcouchdiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fcouchdiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glynnbird","download_url":"https://codeload.github.com/glynnbird/couchdiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244799476,"owners_count":20512254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudant","command-line","couchdb","diff","javascript"],"created_at":"2024-08-01T12:02:56.146Z","updated_at":"2025-03-21T12:32:02.700Z","avatar_url":"https://github.com/glynnbird.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","javascript"],"sub_categories":[],"readme":"# couchdiff\n\nA command-line utility to calculate the difference between two Cloudant/CouchDB datbases. It operates in one of three modes\n\n- default mode - gets a list of document ids and winning revision tokens for each database and \"diffs\" them using the `diff` command. In this mode, if the two databases are deemed equal then they have the same number of documents with the same content up the same revision number. There maybe differences in conflicting revisions. If you are interested in conflict data too, then use `--conflict` mode.\n- `--quick`  - gets the count of documents and deleted documents from each database - if they match then the two databases are deemed to be the same. This is the quickest but least accurate mode of operation.\n- `--conflicts` - same as default mode but also includes revision tokens of non-winning revisions i.e. conflicts. This is the slowest option because *couchdiff* has to stream the whole changes feed including the document bodies\n- `--unified` - outputs the diff in unified format\n\nThis tool relies on two universal command-line tools\n\n- `sort` the *nix command-line tool that sorts text files\n- `diff` the *nix` command-line tool that calculates the difference between text files\n\nThe output of this tool is the output of the final `diff` step - the difference between the two databases.\n\n## Installation\n\nThis is a Node.js app distributed using the `npm` tool:\n\n    \u003e npm install -g couchdiff\n\n## Running\n\nTo calculate the differences between two databases, call `couchdiff` with two URLs. The URLs should include credentials where required, and the database name at the end. Either 'http' or 'https' protocols are supported:\n\n    \u003e  couchdiff http://localhost:5984/mydb1 http://localhost:5984/mydb2\n    spooling changes...\n    sorting...\n    calculating difference...\n    2c2\n    \u003c 1000543/1-3256046064953e2f0fdb376211fe78ab\n    ---\n    \u003e 1000543/2-7d93e4800a6479d8045d192577cff4f7\n\nThe above output shows that document id `1000543` differs in the two databases.\n\nYou can use a combination of local and remote databases:\n\n    \u003e couchdiff http://localhost:5984/mydb https://U:P@myhost.cloudant.com/mydb\n    spooling changes...\n    sorting...\n    calculating difference...\n\nIn this case both databases are identical.\n\n## Quick mode\n\nA quicker, but less thorough check can be performed by adding the `--quick` option:\n\n    \u003e  couchdiff --quick http://localhost:5984/mydb1 http://localhost:5984/mydb2\n    Both databases have the same number of docs and deletions\n\nQuick mode only checks the number of documents and deleted documents in each database, not the revision tokens of each document.\n\n## Conflicts mode\n\nA slower, but very thorough check can be performed by adding the `--conflicts` option which will return differences in the databases not only on the \"winning revisions\" but in any conflicted documents too:\n\n    \u003e couchdiff --conflicts http://localhost:5984/mydb1 http://localhost:5984/mydb2\n    spooling changes...\n    sorting...\n    calculating difference...\n    1c1\n    \u003c mydoc/1-25f9b97d75a648d1fcd23f0a73d2776e/1-icecream\n    ---\n    \u003e mydoc/1-25f9b97d75a648d1fcd23f0a73d2776e/2-7942b2ce39cc4dd85f1809c1756a40c9\n\n## Exit codes\n\n- 0 - both databases are the same\n- 1 - insufficient number of parameters\n- 2 - invalid URL\n- 3 - both databases are different\n\n## IAM Authentication\n\nIf IAM authentication is to be used, then the same API key must have access to the first and second URLs. The API key is supplied through an environment variable: `IAM_API_KEY` e.g.\n\n```sh\nexport IAM_API_KEY=\"my_iam_api_key\"\ncouchdiff \"https://mycloudant.com/mydb\" \"https://mycloudant.com/mydb2\"\n```\n\n## Contributing\n\nThis is an open-source tool released under the Apache-2.0 license. Please feel free to use it, raise issues or contribute pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglynnbird%2Fcouchdiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglynnbird%2Fcouchdiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglynnbird%2Fcouchdiff/lists"}