Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couchdb-expired

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

{
  "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

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

Keywords

FAQs

Package last updated on 03 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc