Skip to content

Only a single index is possible per document #6

@koresar

Description

@koresar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions