sajov/sails-solr

Error on start of sails

Rbourree opened this issue · 3 comments

Hi, I have an error when I start sails project.

Consistency violation: A model (users) references a datastore which cannot be found (solrConnectionOne). If this model definition has an explicit connection property, check that it is spelled correctly. If not, check your default connection (usually located in config/models.js). Finally, check that this connection (solrConnectionOne) is valid as per http://sailsjs.org/documentation/reference/configuration/sails-config-connections.

Model.js
module.exports.models = { connection: 'solrConnectionOne', };

Connection.js
solrConnectionOne: { module : 'sails-solr', host: 'localhost', port: 8983, core: 'schemaless', schema: true, migrate: 'drop' }

User.js
`var bcrypt = require('bcrypt');

module.exports = {
attributes: {
email: {
type: 'email',
required: true,
unique: true
},
phone: {
type: 'string',
required: true,
unique: true
},
password: {
type: 'string',
minLength: 6,
required: true
},
lastname: {
type: 'string'
},
firstname: {
type: 'string'
},
bitrhDate: {
type: 'date'
},
level: {
type: 'integer',
defaultsTo: 0
},
toJSON: function() {
var obj = this.toObject();
delete obj.password;
return obj;
}
},
beforeCreate: function(user, cb) {
bcrypt.genSalt(10, function(err, salt) {
bcrypt.hash(user.password, salt, function(err, hash) {
if (err) {
console.log(err);
cb(err);
} else {
user.password = hash;
cb();
}
});
});
}
};
`

sajov commented

Hi

what version of sails/waterline you are running?

I had this issue earlier --- the doc example needs to be updated. Instead of module : 'sails-solr' it is adapter: 'sails-solr'

sajov commented

I do Not Use Sails anymore. Will Check the docs