pavelvlasov / koa-generic-session-mongo Goto Github PK
View Code? Open in Web Editor NEWMongoDB store for koa-session middleware backed by node-mongodb-native.
License: MIT License
MongoDB store for koa-session middleware backed by node-mongodb-native.
License: MIT License
koa-generic-session set error: Cannot read property 'maxAge' of undefined
at MongoStore.set$ (f:\Users\dev\bbs\node_modules\koa-generic-session-mongo\dist\store.js:195:33)
at tryCatch (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:72:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:334:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (f:\Users\dev\bbs\node_modules\babel-runtime\regenerator\runtime.js:105:21)
at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:65:19)
at f:\Users\dev\bbs\node_modules\co\index.js:54:5
at Object.co (f:\Users\dev\bbs\node_modules\co\index.js:50:10)
at Object.toPromise (f:\Users\dev\bbs\node_modules\co\index.js:118:63)
at next (f:\Users\dev\bbs\node_modules\co\index.js:99:29)
at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:69:7)
at f:\Users\dev\bbs\node_modules\co\index.js:54:5
at Object.co (f:\Users\dev\bbs\node_modules\co\index.js:50:10)
at Object.toPromise (f:\Users\dev\bbs\node_modules\co\index.js:118:63)
at next (f:\Users\dev\bbs\node_modules\co\index.js:99:29)
at onFulfilled (f:\Users\dev\bbs\node_modules\co\index.js:69:7)
at f:\Users\dev\bbs\node_modules\co\index.js:54:5
错误如上,相关的代码
app.use(session({
store: new MongoStore(config.mongodb)
}));
是windows 7 下 node V4.4.3
koa-generic-session-mongo : v:0.0.25
https://github.com/jdesboeufs/connect-mongo#re-use-a-mongoose-connection
const mongoose = require('mongoose');
// Basic usage
mongoose.connect(connectionOptions);
app.use(session({
store: new MongoStore({ mongooseConnection: mongoose.connection })
}));
// Advanced usage
const connection = mongoose.createConnection(connectionOptions);
app.use(session({
store: new MongoStore({ mongooseConnection: connection })
}));
mongo store added two new fields (sid
and ttl
) to the session data (in set(sid, sess, ttl)
)
Issue found by user yuu2lee4
:
from: yuu2lee4
and i found a strange thing, i seted session.user, then i console it, the object has no 'sid' and 'ttl' , but after i setted session.pin , it has 'sid' and 'ttl'
Maybe worth noting in the docs that the url and db args are exclusive, even throw an error if both are provided. I had been using url: 'mongodb://127.0.0.1:27017', db: 'mydb'
and getting admin
db used, which was pretty unclear.
Hi,
Inside dist/store.js the method _makeConnectionString does:
return 'mongodb://' + host + ':' + port + ')/' + db + '?ssl=' + ssl;
That right parenthesis messes up my connection string and I doubt that is something useful.
I think it should be removed.
(row 259)
Regards
I use multiple mongoose
connections in my project thus I would need an option to specify the mongoose
connection. Any suggestions?
new MongoStore({
db: 'db',
collection: 'collection',
user: 'user',
password: 'password'
});
MongoError: Authentication failed.
Receiving the following error on application startup.
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
MongoDB Version: 3.0.3
koa version: 1.0.0
koa-generic-session version: 1.9.2
koa-generic-session-mongo-version: 0.2.2
const koa = require('koa');
const session = require('koa-generic-session');
const MongoStore = require('koa-generic-session-mongo');
const app = koa();
app.keys = ['keys', 'keyskeys'];
app.use(session({
key: 'test.sid',
store: new MongoStore()
}));
app.listen(3000);
Happy to provide more information as needed.
The tests need to clean up after themselves. Ids suggest using a test framework to keep things clearer.
Please Improve the Readme and Specify where those DB options are to be added.
It would be helpful.
Or does it buffer the lookups for when the connection is established?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.