Reputation: 61
i have gone through the sails doc http://sailsjs.org/documentation/reference/configuration/sails-config-session db configuration is
adapter: 'sails-mongo',
host: 'localhost',
port: 27017,
db: 'sails',
collection: 'sessions',
Getting error -->
A hook (
session
) failed to load! error: Could not load Connect session adapter :: sails-mongo installed "sails-mongo" by using npm install sails-mongo
Upvotes: 2
Views: 527
Reputation: 3243
Sails.js uses a different connector for sessions, that is why you are having this problem. All you need to do is install and configure the connect-mongo package to use the same mongodb configured for your data:
You need to run install connect-mongo using npm:
npm install --save connect-mongo
Also, you nees to configure the session adapter in the config/session.js file. And it uses a different format:
// Note: user, pass and port are optional
url: 'mongodb://user:pass@host:port/database',
collection: 'sessions',
auto_reconnect: false,
ssl: false,
stringify: true
All this information is available on this page of the docs: Sails.js session Documentation
Upvotes: 1