# couchdb-expired

> This worker can be launched by cron or other scheduler to run daily and bulk deletions all expired documents from your couchdb databases.

Latest version **0.1.0** (published 2014-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install couchdb-expired
pnpm add couchdb-expired
yarn add couchdb-expired
bun add couchdb-expired
```

Provides the command `expired`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-01-03 |
| First published | 2014-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tom |
| Maintainers | twilson63 |
| Keywords | couchdb, expire, documents |

## Links

- npm: https://www.npmjs.com/package/couchdb-expired
- Repository: https://github.com/twilson63/couchdb-expired
- Issues: https://github.com/twilson63/couchdb-expired/issues
- npm.io page: https://npm.io/package/couchdb-expired

## Dependencies (3)

- [nano](https://npm.io/package/nano.md) ~4.2.1
- [async](https://npm.io/package/async.md) ~0.2.9
- [underscore](https://npm.io/package/underscore.md) ~1.5.2

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-01-03

## README

# CouchDb Expired Worker

This worker can be launched by cron or other scheduler to run daily and bulk
deletions all expired documents from your couchdb databases.

## Install

`npm install expired -g`

## Getting started

First you want to create a config file, this file will list the server and all of your databases that you wish to manage: (eg. expired-config.json)


### Config File Example

``` json
{
  "server": "http://localhost:5984",
  "dbs": ["*"],
  "_design_doc": {
    "_id": "expired",
    "language": "javascript",
    "views": {
      "_default": {
        "map": "function(doc) { \n  var expire = (new Date(doc.expires_in)),\n    today = (new Date());\n  if (expire < today) {\n    emit(doc._id, doc._rev);\n  }\n}\n"
      }
    }
  }
}
```

### add command to crontab to run daily

``` sh
crontab -e
0 3 * * * expired ~/expired-config.json
```
Now every day on the 3rd hour the expire job should run.

## Tests

`npm test`

## Development Environment

* fork and clone
* `npm install`
* `npm test`

## LICENSE

MIT

## Contributions

* Pull Requests welcome, please include tests

## TODO

* add test for design doc creation
* add test for multiple databases

---
_Source: https://npm.io/package/couchdb-expired · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
