cassandrom icon indicating copy to clipboard operation
cassandrom copied to clipboard

No keyspace has been specified. Error during user save

Open dorinmusteata opened this issue 5 years ago • 1 comments

I'm trying to get started with this library , but i receive an error:

Error during user save: ResponseError: No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename

Furthermore , i've checked the index.js and found that keyspace is deleted.

var keyspace = options.keyspace;
  delete options.keyspace;

I've tried to comment the delete options.keyspace , the first error disappeared but i got another error: Error during user save: ResponseError: unconfigured table user

Here is my code (from readme). I'm 100% that my cassandra is working correctly and i do not have any tables in db.


cassandrom.createConnection({
  contactPoints: [cassandraUri],
  localDataCenter: 'datacenter1',
  keyspace: 'my-keyspace'
});
var schema = new cassandrom.Schema({
  userId:   { type: cassandrom.UUIDType, required: true, default: cassandrom.uuid },
  fullName: { type: String, required: true, trim: true },
  username: { type: String, required: true, unique: true, trim: true },
  email:    { type: String, required: true, unique: true, trim: true },
  password: { type: String, required: true },
  date:     { type: Date, default: Date.now, required: true }

}, ['userId']);

var User = cassandrom.model("User", schema);
User.create({
  fullName: 'John Doe',
  username: 'john',
  email: '[email protected]',
  password: 'doedoe'
}, function (error, user) {
  if(error) {
    console.log('Error during user save: ' + error);
  } else {
    console.log('User saved ' + user.userId + ' date ' + user.date);
  }
});

I would like to use this library but i can't pass the errors...

dorinmusteata avatar Mar 29 '19 19:03 dorinmusteata

This issue have being opened with no attention..

Having used this before i find it very confusing when dabbling wiith this, i recommend using datasax and astradb

iamgabrielsoft avatar Sep 03 '21 11:09 iamgabrielsoft