fowl
fowl copied to clipboard
Only a single index is possible per document
This is the code which adds indexes:
exports.addIndex = function(keyPath, fields)
{
fields = _.isArray(fields) ? fields : [fields];
var tr = transaction();
for(var i=0; i<fields.length; i++){
indexes.makeIndex(tr, keyPath, fields[i]);
indexMeta[keyPath.join('/')] = true;
}
return tr.commit();
}
function makeIndex(tr, keyPath, value){
return tr.put([PREFIX, '__meta'].concat(keyPath), value);
}
As you can see you create ALL indexes on the same path. So following code:
fowl.addIndex('indexedpeople', ['name', 'DOB']);
creates index
__ind -> __meta -> indexedpeople is name
but then overwrites it with
__ind -> __meta -> indexedpeople is DOB
.