Closed brett--anderson closed 8 years ago
Hi Brett,
Here is an example for it
FooModel.query(function(qb){
qb.indexName("Local or Global SecondaryIndexName");
})
.where('hashKeyForTheIndex', "value")
.fetch()
.then(function(data){
console.log(data.toJSON());
});
You can switch the target index with QueryBuilder.indexName("name")
Here is a practical usage for indexName in the test. https://github.com/noppoMan/npdynamodb/blob/master/test/query_builder_read_spec.js#L524
Awesome, thanks! I'll close the issue since there are examples in the tests.
How do I write a query with the ORM that will run against a local secondary index, rather than the parent table? I can't see an example of this in the readme.