Class: Model

Cassandra.Model

Create a new Cassandra Model attached to a Cassandra.Schema on the named table and creating the table if it doesn't exist. In general, you should use the instanced method Cassandra#model to attach models

Constructor

new Model(db, name, schema, callback)

Parameters:
Name Type Description
db object the database connection instance
name string the model name, will become the name of the column family
schema object the Cassandra.Schema to be attached
callback function a callback to be called once the table has been created
Source:
To Do:
  • Model.toObject()
Example

Attach a schema to a model for querying

var cassandra = Cassandra.connect(...);
var testSchema = new Cassandra.Schema(...);
var testModel = new Cassandra.Model(cassandra, 'test', testSchema);

Classes

ColumnFamily
MaterializedView
ModelInstance

Methods

_createPartitionKeyQuery(primaryKeyArray)

Given a primary key array object, this will convert it to a PRIMARY KEY (...) string value to use in table creation
Parameters:
Name Type Description
primaryKeyArray array An array specifying the primary key columns, can be compound and composite as well
Source:

_qualifyQueryColumns(queryObject) → {array}

Checks the queryObject's properties against the qualified columns
Parameters:
Name Type Description
queryObject object an object representing column:value
Source:
Throws:
Error - not a valid query column
Returns:
columns - a list of qualified columns
Type
array