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

mongo-ticket

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

mongo-ticket

simple implementation of a single use "ticket", built with mongodb and node.js

  • 0.0.1-pre1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

mongo-ticket

simple implementation of a single use "ticket", built with mongodb and node.js

Installation

npm install mongo-ticket

Options

  • autoConnect whether you want mongo-ticket to immediately connect to the database. If set to false you will have to call the connect method directly (default: true)
  • collection the name to use for the collection that will store tickets (default: 'mongoTicket')
  • stringify whether you want mongo-ticket to try to use JSON.stringify and JSON.parse when storing and retrieving tickets (default: true)

Usage

var mongoTicket = new MongoTicket('mongodb://localhost:27017/mongo-ticket', function (err, db) {
    if (err) // ...

    mongoTicket.set('qwerty', 'keyboard cat', function (err) {
        // ...
    });
});

Later on...

    mongoTicket.get('qwerty', function (err, val) {
        if (err) // ....
        console.log(val); // => 'keyboard cat'
    })

Methods

  • connect(callback) connects to the database with the provided mongodb uri. This is called for you unless to specify autoConnect: false in the options
  • get(ticket, callback) gets a ticket and removes it if found. The arity of the callback is (error, ticketValue), where error is null unless something went wrong, and ticketValue is the (optionally parsed) value stored in the ticket.
  • set(ticket, ticketValue, callback) sets ticket with the given value. The callback is passed directly to the mongodb driver's insert method

FAQs

Package last updated on 09 Jul 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