ODM for Cassandra


This is a model layer and CQL generator which uses the node-cassandra-client project.

  • This is alphaware
  • Assumes all models have a primary key defined (untested otherwise)

The library support modeling two types of Objects.

##Model## You can think of this a traditional Model in the ORM-sense.

You define a mix of properties and associations.

As of now, the only supported default_validation types are:

  • text
  • counter (enables support for incr/decr columns)

##ModelArray## This is a wrapper around columnfamily's with an unknown number of columns.

Use this if you need to support SlicePredicate's (i.e. range queries)

It behaves similar to a list and has support for pagination.


With a ColumnFamily definition of:

    id text PRIMARY KEY,
    make text,
    model text,
    serial int,
    works boolean,
    created_at timestamp,
    updated_at timestamp
) WITH default_validation=text AND comparator=text;

You would have a Model definition as follows:

var Keyboard = Casio.model('Keyboard');'id', String, {
});'make', String, {
});'model', String, {
    default:'Casiotone MT-820'
});'serial', Number, {});'works', Boolean, {});

See test/model and test/keyspaces for more examples.


  • Standalone Cassandra server running on localhost:9160

To run:

  • npm test


  • ./test/


in order to support bigints out of the box the cassandra-client connections must enable them. still trying to figure out the best way to support these.

Not currently supporting unique values Requires doing a manual lookup if you need unique column support Will eventually work, but requires validation hooks are in place, first.