GithubHelp home page GithubHelp logo

kiril-me / cassandrom Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 3.0 466 KB

Cassandra object modeling tool for Node.Js like mongoose

License: Apache License 2.0

JavaScript 100.00%
cassandra javascript mongoose nodejs orm

cassandrom's People

Contributors

kiril-me avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cassandrom's Issues

createTableIfNotExists always giving error

Hello.
I'm directly calling cassandrom.connection.model with the table name and the schema, so I'm sure that if the table not exists it creates it.
But I noticed that this always gives back an error (if the table exists), because the query "SELECT table_name FROM system_schema.tables WHERE keyspace_name=?" always gives back 0 results, and I think it's because the table "system_schema.tables" has just a column and it's called "table_name", and not "keyspace_name".

No keyspace has been specified. Error during user save

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.