UNPKG

fruitstand

Version:
45 lines (44 loc) 5.19 kB
{ "name": "connect-mongo", "version": "0.4.0", "description": "MongoDB session store for Connect", "keywords": [ "connect", "mongo", "mongodb", "session", "express" ], "author": { "name": "Casey Banner", "email": "kcbanner@gmail.com" }, "repository": { "type": "git", "url": "https://github.com/kcbanner/connect-mongo.git" }, "bugs": { "url": "https://github.com/kcbanner/connect-mongo/issues" }, "dependencies": { "mongodb": "1.3.x" }, "directories": { "lib": "./lib" }, "devDependencies": { "mocha": "1.x", "connect": ">= 1.x", "mongoose": ">= 2.6.x" }, "scripts": { "test": "make test" }, "main": "./lib/connect-mongo", "engines": "node >= 0.4.x", "readme": "# connect-mongo\n\n MongoDB session store for Connect\n\n [![Build Status](https://secure.travis-ci.org/kcbanner/connect-mongo.png?branch=master)](http://travis-ci.org/kcbanner/connect-mongo)\n\n## Installation\n\nconnect-mongo supports only connect `>= 1.0.3`.\n\nvia npm:\n\n $ npm install connect-mongo\n\n## Options\n\n - `db` Database name OR fully instantiated node-mongo-native object\n - `collection` Collection (optional, default: `sessions`) \n - `host` MongoDB server hostname (optional, default: `127.0.0.1`)\n - `port` MongoDB server port (optional, default: `27017`)\n - `username` Username (optional)\n - `password` Password (optional)\n - `auto_reconnect` This is passed directly to the MongoDB `Server` constructor as the auto_reconnect\n option (optional, default: false).\n - `ssl` Use SSL to connect to MongoDB (optional, default: false).\n - `url` Connection url of the form: `mongodb://user:pass@host:port/database/collection`.\n If provided, information in the URL takes priority over the other options.\n - `mongoose_connection` in the form: `someMongooseDb.connections[0]` to use an existing mongoose connection. (optional)\n - `stringify` If true, connect-mongo will serialize sessions using `JSON.stringify` before\n setting them, and deserialize them with `JSON.parse` when getting them.\n (optional, default: true). This is useful if you are using types that \n MongoDB doesn't support.\n\nThe second parameter to the `MongoStore` constructor is a callback which will be called once the database connection is established.\nThis is mainly used for the tests, however you can use this callback if you want to wait until the store has connected before\nstarting your app.\n\n## Example\n\nWith express:\n\n var express = require('express');\n var MongoStore = require('connect-mongo')(express);\n\n app.use(express.session({\n secret: settings.cookie_secret,\n store: new MongoStore({\n db: settings.db\n })\n }));\n\nWith connect:\n\n var connect = require('connect');\n var MongoStore = require('connect-mongo')(connect);\n\n## Removing expired sessions\n\n connect-mongo uses MongoDB's TTL collection feature (2.2+) to\n have mongod automatically remove expired sessions. (mongod runs this\n check every minute.)\n\n **Note:** By connect/express's default, session cookies are set to \n expire when the user closes their browser (maxAge: null). In accordance\n with standard industry practices, connect-mongo will set these sessions\n to expire two weeks from their last 'set'. You can override this \n behavior by manually setting the maxAge for your cookies -- just keep in\n mind that any value less than 60 seconds is pointless, as mongod will\n only delete expired documents in a TTL collection every minute.\n\n For more information, consult connect's [session documentation](http://www.senchalabs.org/connect/session.html)\n\n## Tests\n\nYou need `mocha`.\n\n make test\n\nThe tests use a database called `connect-mongo-test`.\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 Casey Banner <kcbanner@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", "readmeFilename": "Readme.md", "homepage": "https://github.com/kcbanner/connect-mongo", "_id": "connect-mongo@0.4.0", "_from": "connect-mongo@" }