Is there a high-level DynamoDB module for Node.js that supports secondary indexes?

I see quite a few DynamoDB modules on npmjs.org. I am guessing that all of them pre-date the introduction of secondary indexes and so don't support them. Does anyone know of a high-level DynamoDB module for Node.js that supports secondary indexes?

The AWS SDK for Node.js supports secondary indices for Amazon DynamoDB. You can find the code for it on github or you can get it through npm:

npm install aws-sdk

One of the modules I've written, dynamo-table, supports secondary indexes.

You can specify them in your table constructor and then the library can determine if indexes are required in a query:

table = dynamoTable('customers', {
  key: ['id', 'name'],
  indexes: {emailIx: 'email'}
})

table.query({id: 'a', email: {'>': 'b'}}, function(err, items) {
  // query will have been called with IndexName: emailIx
})

A createTable call will also create the table with the given secondary indexes - and you can specify projections, and types as well.

table = dynamoTable('customers', {
  key: ['id', 'name'],
  keyTypes: {age: 'N'},
  indexes: {ageIx: {key: 'age', projection: ['address', 'dob']}}
})

table.createTable(function(err) {
  // will correctly populate LocalSecondaryIndexes and AttributeDefinitions
})

Documentation is a bit light on the ground at the moment (typical!), but you should be able to find out more from the tests.

If you like a MongoDB like interface you can use: https://github.com/aaaristo/dyngodb

npm install -g dyngodb

I recently started using vogels. It's great - seems well maintained enough and has mongoose-like syntax. It supports secondary indexes and parallel scans, which very few (no?) other dynamo sdk's do. I don't know why I didn't find it in the first 100 searches I did for dynamo+node libraries...